]> git.jsancho.org Git - lugaru.git/commitdiff
Some cleans, fullscreen is back if "--windowed" isn't passed as option.
authorCôme BERNIGAUD <come.bernigaud@gmail.com>
Fri, 13 May 2011 16:33:39 +0000 (18:33 +0200)
committerCôme BERNIGAUD <come.bernigaud@gmail.com>
Fri, 13 May 2011 16:33:39 +0000 (18:33 +0200)
Source/Account.cpp
Source/Account.h
Source/Game.h
Source/GameDraw.cpp
Source/GameInitDispose.cpp
Source/OpenGL_Windows.cpp

index 662c0d35ea2c48832d86945ef65e48c6e3ee0b3d..7eba58815332e28c4edda56ca0be8fd99c7a7c87 100644 (file)
@@ -46,12 +46,6 @@ Account::Account(string n) : campaignProgress() {
 
 void Account::setCurrentCampaign(string name) {
        currentCampaign = name;
-       if(campaignProgress.find(name)==campaignProgress.end()) {
-               campaignProgress[name].highscore = 0;
-               campaignProgress[name].fasttime = 0;
-               campaignProgress[name].score = 0;
-               campaignProgress[name].time = 0;
-       }
 }
 
 Account* Account::add(string name) {
@@ -218,7 +212,7 @@ void Account::saveFile(string filename, Account* accountactive) {
                        fpackf(tfile, "Bi", a->progress);
                        fpackf(tfile, "Bi", a->campaignProgress.size());
                        
-                       map<string,campaign_progress_t>::const_iterator it;
+                       map<string,CampaignProgress>::const_iterator it;
                        for( it=a->campaignProgress.begin(); it!= a->campaignProgress.end(); ++it) {
                                fpackf(tfile, "Bi",  it->first.size());
                                for(j=0;j<it->first.size();j++)
index 599384cea8a8718faaf9b4a97ee16537c1403ee0..7d550e81e7534597a6f0161a349aa1739a0fe187 100644 (file)
@@ -28,13 +28,19 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 #include <map>
 #include <fstream>
 
-typedef struct {
+struct CampaignProgress {
        float highscore;
        float fasttime;
        float score;
        float time;
        std::vector<int> choices;
-} campaign_progress_t;
+       CampaignProgress() {
+               highscore = 0;
+               fasttime = 0;
+               score = 0;
+               time = 0;
+       }
+};
 
 class Account {
        public:
@@ -88,7 +94,7 @@ class Account {
                std::string name;
                
                std::string currentCampaign;
-               std::map<std::string,campaign_progress_t> campaignProgress;
+               std::map<std::string,CampaignProgress> campaignProgress;
        
        //statics
                static std::vector<Account*> accounts;
index 00dfb53dd47f280ed1705905f58300ec78805cca..32d14890b9f1b2f79fe3a0bbfca12f18291904e4 100644 (file)
@@ -300,7 +300,7 @@ class Game
 
 //keeps track of which textures are loaded
 //TODO: delete them properly
-struct TextureInfo{
+struct TextureInfo {
     bool isLoaded;
     bool isSkin;
     const char* fileName;
@@ -310,7 +310,7 @@ struct TextureInfo{
     GLubyte* array;
     int* skinsize;
 
-    void load(){
+    void load() {
         if(isSkin)
             Game::LoadTextureSaveData(fileName,ptextureid,mipmap,array,skinsize,isLoaded);
         else
index f9250784564254750f0c01d42062d97d23805504..c1fb5532b20768efb0b010629316312cd603fdc7 100644 (file)
@@ -2692,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;
index 10ead719f16a8c7de63f44f8eb3277d3ee0606c4..b9d5913fd1f2df0b5fa4f3fe7a19c14e385365fd 100644 (file)
@@ -850,7 +850,7 @@ void Game::InitGame()
 }
 
 
-void Game::LoadScreenTexture(){
+void Game::LoadScreenTexture() {
     glPixelStorei( GL_UNPACK_ALIGNMENT, 1 );
 
     if(!screentexture)
index cc8103ce8e80e7cfbbf61f4093006d0c421c3aea..b25b0cba26dbf01ef8f5fc8d1c546105ee4bbe61 100644 (file)
@@ -248,7 +248,7 @@ static void toggleFullscreen(){
         exit(1);
     //reload opengl state
     initGL();
-    for(std::vector<TextureInfo>::iterator it=Game::textures.begin(); it!=Game::textures.end(); it++){
+    for(std::vector<TextureInfo>::iterator it=Game::textures.begin(); it!=Game::textures.end(); it++) {
         it->load();
     }
     pgame->text.BuildFont();
@@ -362,9 +362,9 @@ Boolean SetUp (Game & game)
        }
 
     Uint32 sdlflags = SDL_OPENGL;
-    //TODO: commented out temporarily
-    //if (!cmdline("windowed"))
-        //sdlflags |= SDL_FULLSCREEN;
+    
+    if (!cmdline("windowed"))
+        sdlflags |= SDL_FULLSCREEN;
 
     SDL_WM_SetCaption("Lugaru", "Lugaru");