]> git.jsancho.org Git - lugaru.git/blobdiff - Source/GameTick.cpp
Got rid of global texture var. Calling load_image directly
[lugaru.git] / Source / GameTick.cpp
index 4da057ed2b74006d4444487bd1c2e1db793b06d9..ea591632aaa143dd4a42aa6badb6c22f98e3d051 100644 (file)
@@ -125,7 +125,6 @@ extern float damagedealt;
 extern int maptype;
 extern int editoractive;
 extern int editorpathtype;
-extern ImageRec texture;
 
 extern float hostiletime;
 
@@ -388,7 +387,8 @@ bool Game::AddClothes(const char *fileName, GLubyte *array)
 {
     LOGFUNC;
     //Load Image
-    bool opened = upload_image(fileName);
+    ImageRec texture;
+    bool opened = load_image(fileName, texture);
 
     float alphanum;
     //Is it valid?
@@ -659,10 +659,6 @@ void Setenvironment(int which)
         terraintexture.load(":Data:Textures:snow.jpg", 1, 0);
         terraintexture2.load(":Data:Textures:rock.jpg", 1, 0);
 
-        //LoadTexture(":Data:Textures:detailgrain.png",&terraintexture3,1);
-
-
-
 
         temptexdetail = texdetail;
         if (texdetail > 1)
@@ -698,9 +694,6 @@ void Setenvironment(int which)
         terraintexture.load(":Data:Textures:sand.jpg", 1, 0);
         terraintexture2.load(":Data:Textures:sandslope.jpg", 1, 0);
 
-        //LoadTexture(":Data:Textures:detailgrain.png",&terraintexture3,1);
-
-
 
         temptexdetail = texdetail;
         if (texdetail > 1)
@@ -735,9 +728,6 @@ void Setenvironment(int which)
         terraintexture.load(":Data:Textures:grassdirt.jpg", 1, 0);
         terraintexture2.load(":Data:Textures:mossrock.jpg", 1, 0);
 
-        //LoadTexture(":Data:Textures:detail.png",&terraintexture3,1);
-
-
 
         temptexdetail = texdetail;
         if (texdetail > 1)
@@ -1135,11 +1125,9 @@ void Game::Loadlevel(const char *name)
 
             float maxdistance = 0;
             float tempdist;
-            //~ int whichclosest;
             for (int i = 0; i < objects.numobjects; i++) {
                 tempdist = distsq(&objects.center, &objects.position[i]);
                 if (tempdist > maxdistance) {
-                    //~ whichclosest=i;
                     maxdistance = tempdist;
                 }
             }
@@ -1195,7 +1183,6 @@ void Game::Loadlevel(const char *name)
                         }
                     }
                     funpackf(tfile, "Bi", &Person::players[i - howmanyremoved]->numwaypoints);
-                    //Person::players[i-howmanyremoved]->numwaypoints=10;
                     for (int j = 0; j < Person::players[i - howmanyremoved]->numwaypoints; j++) {
                         funpackf(tfile, "Bf", &Person::players[i - howmanyremoved]->waypoints[j].x);
                         funpackf(tfile, "Bf", &Person::players[i - howmanyremoved]->waypoints[j].y);
@@ -1600,7 +1587,6 @@ void doTutorial()
             break;
         case 19:
             tutorialstage = 20;
-            //tutorialmaxtime=500;
             break;
         case 20:
             tutorialmaxtime = 500;
@@ -2055,7 +2041,7 @@ void doDebugKeys()
         }
 
         if (Input::isKeyPressed(SDL_SCANCODE_C)) {
-            cameramode = 1 - cameramode;
+            cameramode = !cameramode;
         }
 
         if (Input::isKeyPressed(SDL_SCANCODE_X) && !Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
@@ -2386,7 +2372,7 @@ void doDebugKeys()
         }
 
         if (Input::isKeyPressed(SDL_SCANCODE_M) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
-            editorenabled = 1 - editorenabled;
+            editorenabled = !editorenabled;
             if (editorenabled) {
                 Person::players[0]->damagetolerance = 100000;
             } else {
@@ -3197,7 +3183,6 @@ void doAerialAcrobatics()
 
 void doAttacks()
 {
-    static XYZ relative;
     static int randattack;
     static bool playerrealattackkeydown = 0;
 
@@ -5525,7 +5510,7 @@ void MenuTick()
         displayblinkdelay -= multiplier;
         if (displayblinkdelay <= 0) {
             displayblinkdelay = .3;
-            displayblink = 1 - displayblink;
+            displayblink = !displayblink;
         }
     }
 
@@ -5684,7 +5669,7 @@ void Game::Tick()
 
         //keys
         if (Input::isKeyPressed(SDL_SCANCODE_V) && debugmode) {
-            freeze = 1 - freeze;
+            freeze = !freeze;
             if (freeze) {
                 OPENAL_SetFrequency(OPENAL_ALL, 0.001);
             }
@@ -5718,7 +5703,7 @@ void Game::Tick()
             consoleblinkdelay -= multiplier;
             if (consoleblinkdelay <= 0) {
                 consoleblinkdelay = .3;
-                consoleblink = 1 - consoleblink;
+                consoleblink = !consoleblink;
             }
         }