]> git.jsancho.org Git - lugaru.git/blobdiff - Source/GameTick.cpp
Cleaned up a bit clothes adding
[lugaru.git] / Source / GameTick.cpp
index 4ff12507e57df0ad63d87be1cbbf30ef4351bda3..c66767df4012221c9b61621ad4b245160bb8cda5 100644 (file)
@@ -125,7 +125,6 @@ extern float damagedealt;
 extern int maptype;
 extern int editoractive;
 extern int editorpathtype;
-extern ImageRec texture;
 
 extern float hostiletime;
 
@@ -384,49 +383,6 @@ void Game::playdialogueboxsound()
 
 // ================================================================
 
-bool Game::AddClothes(const char *fileName, GLubyte *array)
-{
-    LOGFUNC;
-    //Load Image
-    bool opened = upload_image(fileName);
-
-    float alphanum;
-    //Is it valid?
-    if (opened) {
-        if (tintr > 1) tintr = 1;
-        if (tintg > 1) tintg = 1;
-        if (tintb > 1) tintb = 1;
-
-        if (tintr < 0) tintr = 0;
-        if (tintg < 0) tintg = 0;
-        if (tintb < 0) tintb = 0;
-
-        int bytesPerPixel = texture.bpp / 8;
-
-        int tempnum = 0;
-        alphanum = 255;
-        for (int i = 0; i < (int)(texture.sizeY * texture.sizeX * bytesPerPixel); i++) {
-            if (bytesPerPixel == 3)
-                alphanum = 255;
-            else if ((i + 1) % 4 == 0)
-                alphanum = texture.data[i];
-            if ((i + 1) % 4 || bytesPerPixel == 3) {
-                if ((i % 4) == 0)
-                    texture.data[i] *= tintr;
-                if ((i % 4) == 1)
-                    texture.data[i] *= tintg;
-                if ((i % 4) == 2)
-                    texture.data[i] *= tintb;
-                array[tempnum] = (float)array[tempnum] * (1 - alphanum / 255) + (float)texture.data[i] * (alphanum / 255);
-                tempnum++;
-            }
-        }
-        return 1;
-    } else {
-        return 0;
-    }
-}
-
 int Game::findClosestPlayer()
 {
     int closest = -1;
@@ -659,10 +615,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 +650,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 +684,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 +1081,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 +1139,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);
@@ -1363,7 +1306,7 @@ void Game::Loadlevel(const char *name)
                     tintr = Person::players[i]->clothestintr[j];
                     tintg = Person::players[i]->clothestintg[j];
                     tintb = Person::players[i]->clothestintb[j];
-                    AddClothes((char *)Person::players[i]->clothes[j], &Person::players[i]->skeleton.skinText[0]);
+                    Person::players[i]->addClothes(j);
                 }
                 Person::players[i]->DoMipmaps();
             }
@@ -1600,7 +1543,6 @@ void doTutorial()
             break;
         case 19:
             tutorialstage = 20;
-            //tutorialmaxtime=500;
             break;
         case 20:
             tutorialmaxtime = 500;
@@ -2120,7 +2062,7 @@ void doDebugKeys()
                     tintr = Person::players[closest]->clothestintr[i];
                     tintg = Person::players[closest]->clothestintg[i];
                     tintb = Person::players[closest]->clothestintb[i];
-                    AddClothes((char *)Person::players[closest]->clothes[i], &Person::players[closest]->skeleton.skinText[0]);
+                    Person::players[closest]->addClothes(i);
                 }
                 Person::players[closest]->DoMipmaps();
             }
@@ -2147,7 +2089,7 @@ void doDebugKeys()
                 if (Person::players[closest]->creature == rabbittype) {
                     Person::players[closest]->skeleton.id = closest;
                     Person::players[closest]->skeleton.Load((char *)":Data:Skeleton:Basic Figure Wolf", (char *)":Data:Skeleton:Basic Figure Wolf Low", (char *)":Data:Skeleton:Rabbitbelt", (char *)":Data:Models:Wolf.solid", (char *)":Data:Models:Wolf2.solid", (char *)":Data:Models:Wolf3.solid", (char *)":Data:Models:Wolf4.solid", (char *)":Data:Models:Wolf5.solid", (char *)":Data:Models:Wolf6.solid", (char *)":Data:Models:Wolf7.solid", (char *)":Data:Models:Wolflow.solid", (char *)":Data:Models:Belt.solid", 0);
-                    Person::players[closest]->skeleton.drawmodel.textureptr.load(":Data:Textures:Wolf.jpg", 1, &Person::players[closest]->skeleton.skinText[closest], &Person::players[closest]->skeleton.skinsize);
+                    Person::players[closest]->skeleton.drawmodel.textureptr.load(":Data:Textures:Wolf.jpg", 1, &Person::players[closest]->skeleton.skinText[0], &Person::players[closest]->skeleton.skinsize);
                     Person::players[closest]->whichskin = 0;
                     Person::players[closest]->creature = wolftype;
 
@@ -2558,7 +2500,7 @@ void doDebugKeys()
                         tintr = Person::players.back()->clothestintr[i];
                         tintg = Person::players.back()->clothestintg[i];
                         tintb = Person::players.back()->clothestintb[i];
-                        AddClothes((char *)Person::players.back()->clothes[i], &Person::players.back()->skeleton.skinText[0]);
+                        Person::players.back()->addClothes(i);
                     }
                 if (Person::players.back()->numclothes) {
                     Person::players.back()->DoMipmaps();
@@ -3197,7 +3139,6 @@ void doAerialAcrobatics()
 
 void doAttacks()
 {
-    static XYZ relative;
     static int randattack;
     static bool playerrealattackkeydown = 0;