]> git.jsancho.org Git - lugaru.git/commitdiff
Moved creatures skins to PersonType class
authorCôme Chilliet <come@chilliet.eu>
Sun, 5 Feb 2017 20:57:18 +0000 (21:57 +0100)
committerCôme Chilliet <come@chilliet.eu>
Sun, 5 Feb 2017 20:57:18 +0000 (21:57 +0100)
Source/Devtools/ConsoleCmds.cpp
Source/Game.hpp
Source/GameTick.cpp
Source/Objects/Person.cpp
Source/Objects/Person.hpp

index 94cb002bf9676318bff690b099923bc3d9165ddc..fba2400a3277b01ee1548197b4a8551db39073fa 100644 (file)
@@ -121,7 +121,7 @@ static void set_noclothes(int pnum, const char*)
 {
     Person::players[pnum]->numclothes = 0;
     Person::players[pnum]->skeleton.drawmodel.textureptr.load(
-        creatureskin[Person::players[pnum]->creature][Person::players[pnum]->whichskin], 1,
+        PersonType::types[Person::players[pnum]->creature].skins[Person::players[pnum]->whichskin], 1,
         &Person::players[pnum]->skeleton.skinText[0], &Person::players[pnum]->skeleton.skinsize);
 }
 
@@ -648,7 +648,7 @@ void ch_default(const char*)
 
     Person::players[0]->numclothes = 0;
     Person::players[0]->skeleton.drawmodel.textureptr.load(
-        creatureskin[Person::players[0]->creature][Person::players[0]->whichskin], 1,
+        PersonType::types[Person::players[0]->creature].skins[Person::players[0]->whichskin], 1,
         &Person::players[0]->skeleton.skinText[0], &Person::players[0]->skeleton.skinsize);
 
     editoractive = typeactive;
index 63070927149d101fd87f619e554558193b5b814e..c5a3632ed6c7430a7039bd0b0b80610c33e74125 100644 (file)
@@ -201,16 +201,9 @@ enum editortypes {typeactive, typesitting, typesittingwall, typesleeping,
 
 extern const char *editortypenames[8];
 
-extern const char *rabbitskin[10];
-
-extern const char *wolfskin[3];
-
-extern const char **creatureskin[2];
-
 SDL_bool sdlEventProc(const SDL_Event &e);
 
 
-
 enum  optionIndex { UNKNOWN, VERSION, HELP, FULLSCREEN, NOMOUSEGRAB, SOUND, OPENALINFO, SHOWRESOLUTIONS, DEVTOOLS };
 /* Number of options + 1 */
 const int commandLineOptionsNumber = 10;
index a0bb4b3928dddfc767f48ef7ed760dcdd9a4c267..c1b038671b454c23beb94698377197e455d84ca6 100644 (file)
@@ -148,27 +148,6 @@ float musicvolume[4] = {};
 float oldmusicvolume[4] = {};
 int musicselected = 0;
 
-const char* rabbitskin[] = {
-    "Textures/Fur3.jpg",
-    "Textures/Fur.jpg",
-    "Textures/Fur2.jpg",
-    "Textures/Lynx.jpg",
-    "Textures/Otter.jpg",
-    "Textures/Opal.jpg",
-    "Textures/Sable.jpg",
-    "Textures/Chocolate.jpg",
-    "Textures/BW2.jpg",
-    "Textures/WB2.jpg"
-};
-
-const char* wolfskin[] = {
-    "Textures/Wolf.jpg",
-    "Textures/DarkWolf.jpg",
-    "Textures/SnowWolf.jpg"
-};
-
-const char** creatureskin[] = { rabbitskin, wolfskin };
-
 #define STATIC_ASSERT(x) extern int s_a_dummy[2 * (!!(x)) - 1];
 STATIC_ASSERT(rabbittype == 0 && wolftype == 1)
 
@@ -1213,7 +1192,7 @@ void Game::ProcessDevInput()
                 }
 
                 Person::players[closest]->skeleton.drawmodel.textureptr.load(
-                    creatureskin[Person::players[closest]->creature][Person::players[closest]->whichskin], 1,
+                    PersonType::types[Person::players[closest]->creature].skins[Person::players[closest]->whichskin], 1,
                     &Person::players[closest]->skeleton.skinText[0], &Person::players[closest]->skeleton.skinsize);
             }
 
index 0d4fa9a2cf9b1868427f4cd0484128fe15ed9839..6c4bbbbb42df9559c0f09b4a03af5e5230f1c0fb 100644 (file)
@@ -114,6 +114,11 @@ void PersonType::Load()
     types[wolftype].lowModelFileName = "Models/WolfLow.solid";
     types[wolftype].modelClothesFileName = "Models/Belt.solid";
 
+    types[wolftype].skins.resize(3);
+    types[wolftype].skins[0] = "Textures/Wolf.jpg";
+    types[wolftype].skins[1] = "Textures/DarkWolf.jpg";
+    types[wolftype].skins[2] = "Textures/SnowWolf.jpg";
+
     /* Rabbit */
     types[rabbittype].proportions[0] = 1.2;
     types[rabbittype].proportions[1] = 1.05;
@@ -147,6 +152,18 @@ void PersonType::Load()
     types[rabbittype].modelFileNames[6] = "Models/Body7.solid";
     types[rabbittype].lowModelFileName = "Models/BodyLow.solid";
     types[rabbittype].modelClothesFileName = "Models/Belt.solid";
+
+    types[rabbittype].skins.resize(10);
+    types[rabbittype].skins[0] = "Textures/Fur3.jpg";
+    types[rabbittype].skins[1] = "Textures/Fur.jpg";
+    types[rabbittype].skins[2] = "Textures/Fur2.jpg";
+    types[rabbittype].skins[3] = "Textures/Lynx.jpg";
+    types[rabbittype].skins[4] = "Textures/Otter.jpg";
+    types[rabbittype].skins[5] = "Textures/Opal.jpg";
+    types[rabbittype].skins[6] = "Textures/Sable.jpg";
+    types[rabbittype].skins[7] = "Textures/Chocolate.jpg";
+    types[rabbittype].skins[8] = "Textures/BW2.jpg";
+    types[rabbittype].skins[9] = "Textures/WB2.jpg";
 }
 
 Person::Person()
@@ -541,7 +558,7 @@ void Person::skeletonLoad(bool clothes)
         PersonType::types[creature].modelClothesFileName,
         clothes);
 
-    skeleton.drawmodel.textureptr.load(creatureskin[creature][whichskin], 1, &skeleton.skinText[0], &skeleton.skinsize);
+    skeleton.drawmodel.textureptr.load(PersonType::types[creature].skins[whichskin], 1, &skeleton.skinText[0], &skeleton.skinsize);
 }
 
 void Person::setProportions(float head, float body, float arms, float legs)
index 1b9a01c8f079b1d997f94b1eca7a2980302fa397..d67c503219e8660987c1ac13958a1a478f30262c 100644 (file)
@@ -77,6 +77,8 @@ public:
     std::string lowModelFileName;
     std::string modelClothesFileName;
 
+    std::vector<std::string> skins;
+
     static std::vector<PersonType> types;
     static void Load();
 };