]> git.jsancho.org Git - lugaru.git/blobdiff - Source/GameInitDispose.cpp
Cleaned up Objects handling
[lugaru.git] / Source / GameInitDispose.cpp
index d950c2ebb9d52bd9a228131f19c5a4c65cd509e0..38815d9ee56206ef427bde0020460026dcae30da 100644 (file)
@@ -38,7 +38,6 @@ extern int kTextureSize;
 extern float texdetail;
 extern float realtexdetail;
 extern float volume;
-extern Objects objects;
 extern int detail;
 extern bool cellophane;
 extern GLubyte bloodText[512 * 512 * 3];
@@ -83,7 +82,7 @@ void Dispose()
         Game::endgame = 0;
     }
 
-    Account::saveFile(Folders::getUserDataPath()+"/users");
+    Account::saveFile(Folders::getUserSavePath());
 
     //textures.clear();
 
@@ -458,7 +457,7 @@ void Game::InitGame()
 
     numchallengelevels = 14;
 
-    Account::loadFile(Folders::getUserDataPath()+"/users");
+    Account::loadFile(Folders::getUserSavePath());
 
     whichjointstartarray[0] = righthip;
     whichjointendarray[0] = rightfoot;
@@ -656,7 +655,6 @@ void Game::LoadStuff()
 {
     static float temptexdetail;
     static float viewdistdetail;
-    static int i, j;
     float megascale = 1;
 
     LOGFUNC;
@@ -669,7 +667,6 @@ void Game::LoadStuff()
         p->skeleton.drawmodel.textureptr.destroy();
     }
 
-    i = abs(Random() % 4);
     visibleloading = 0; //don't use loadscreentexture yet
     loadscreentexture.load("Textures/Fire.jpg", 1);
     visibleloading = 1;
@@ -685,12 +682,13 @@ void Game::LoadStuff()
 
     if (detail == 2) {
         texdetail = 1;
-    }
-    if (detail == 1) {
+        kTextureSize = 1024;
+    } else if (detail == 1) {
         texdetail = 2;
-    }
-    if (detail == 0) {
+        kTextureSize = 512;
+    } else {
         texdetail = 4;
+        kTextureSize = 256;
     }
 
     realtexdetail = texdetail;
@@ -757,14 +755,6 @@ void Game::LoadStuff()
 
     viewer = 0;
 
-
-    if (detail)
-        kTextureSize = 1024;
-    if (detail == 1)
-        kTextureSize = 512;
-    if (detail == 0)
-        kTextureSize = 256;
-
     //Set up distant light
     light.color[0] = .95;
     light.color[1] = .95;
@@ -828,23 +818,23 @@ void Game::LoadStuff()
     moveamount.z = 2;
     // FIXME - Why this uses skeleton.joints.size() and not Animation::numjoints? (are they equal?)
     // It seems skeleton.joints.size() is 0 at this point, so this is useless.
-    for (i = 0; i < Person::players[0]->skeleton.joints.size(); i++) {
-        for (j = 0; j < Animation::animations[knifesneakattackanim].frames.size(); j++) {
+    for (unsigned i = 0; i < Person::players[0]->skeleton.joints.size(); i++) {
+        for (unsigned j = 0; j < Animation::animations[knifesneakattackanim].frames.size(); j++) {
             Animation::animations[knifesneakattackanim].frames[j].joints[i].position += moveamount;
         }
     }
 
     LoadingScreen();
 
-    for (i = 0; i < Person::players[0]->skeleton.joints.size(); i++) {
-        for (j = 0; j < Animation::animations[knifesneakattackedanim].frames.size(); j++) {
+    for (unsigned i = 0; i < Person::players[0]->skeleton.joints.size(); i++) {
+        for (unsigned j = 0; j < Animation::animations[knifesneakattackedanim].frames.size(); j++) {
             Animation::animations[knifesneakattackedanim].frames[j].joints[i].position += moveamount;
         }
     }
 
     LoadingScreen();
 
-    for (i = 0; i < Person::players[0]->skeleton.joints.size(); i++) {
+    for (unsigned i = 0; i < Person::players[0]->skeleton.joints.size(); i++) {
         Animation::animations[dead1anim].frames[1].joints[i].position = Animation::animations[dead1anim].frames[0].joints[i].position;
         Animation::animations[dead2anim].frames[1].joints[i].position = Animation::animations[dead2anim].frames[0].joints[i].position;
         Animation::animations[dead3anim].frames[1].joints[i].position = Animation::animations[dead3anim].frames[0].joints[i].position;
@@ -860,20 +850,20 @@ void Game::LoadStuff()
     Animation::animations[dead3anim].frames[1].speed = 0.001;
     Animation::animations[dead4anim].frames[1].speed = 0.001;
 
-    for (i = 0; i < Person::players[0]->skeleton.joints.size(); i++) {
-        for (j = 0; j < Animation::animations[swordsneakattackanim].frames.size(); j++) {
+    for (unsigned i = 0; i < Person::players[0]->skeleton.joints.size(); i++) {
+        for (unsigned j = 0; j < Animation::animations[swordsneakattackanim].frames.size(); j++) {
             Animation::animations[swordsneakattackanim].frames[j].joints[i].position += moveamount;
         }
     }
     LoadingScreen();
-    for (j = 0; j < Animation::animations[swordsneakattackanim].frames.size(); j++) {
+    for (unsigned j = 0; j < Animation::animations[swordsneakattackanim].frames.size(); j++) {
         Animation::animations[swordsneakattackanim].frames[j].weapontarget += moveamount;
     }
 
     LoadingScreen();
 
-    for (i = 0; i < Person::players[0]->skeleton.joints.size(); i++) {
-        for (j = 0; j < Animation::animations[swordsneakattackedanim].frames.size(); j++) {
+    for (unsigned i = 0; i < Person::players[0]->skeleton.joints.size(); i++) {
+        for (unsigned j = 0; j < Animation::animations[swordsneakattackedanim].frames.size(); j++) {
             Animation::animations[swordsneakattackedanim].frames[j].joints[i].position += moveamount;
         }
     }