]> git.jsancho.org Git - lugaru.git/commitdiff
Moved Weapon model and texture loading in Weapon class
authorCôme Chilliet <come@chilliet.eu>
Wed, 4 Jan 2017 14:00:53 +0000 (15:00 +0100)
committerCôme Chilliet <come@chilliet.eu>
Wed, 4 Jan 2017 14:00:53 +0000 (15:00 +0100)
Source/GameInitDispose.cpp
Source/Objects/Weapons.cpp
Source/Objects/Weapons.hpp

index 2922eaf29e312c4b989eb3580d522f1790cb4397..984202ffc75fff2d6f7769e749b2b2aa806740b7 100644 (file)
@@ -661,38 +661,7 @@ void Game::LoadStuff()
 
     realtexdetail = texdetail;
 
-    LOG("Loading weapon data...");
-
-    Weapon::knifetextureptr.load("Textures/Knife.png", 0);
-    Weapon::bloodknifetextureptr.load("Textures/BloodKnife.png", 0);
-    Weapon::lightbloodknifetextureptr.load("Textures/BloodKnifeLight.png", 0);
-    Weapon::swordtextureptr.load("Textures/Sword.jpg", 1);
-    Weapon::bloodswordtextureptr.load("Textures/SwordBlood.jpg", 1);
-    Weapon::lightbloodswordtextureptr.load("Textures/SwordBloodLight.jpg", 1);
-    Weapon::stafftextureptr.load("Textures/Staff.jpg", 1);
-
-    Weapon::throwingknifemodel.load("Models/ThrowingKnife.solid");
-    Weapon::throwingknifemodel.Scale(.001, .001, .001);
-    Weapon::throwingknifemodel.Rotate(90, 0, 0);
-    Weapon::throwingknifemodel.Rotate(0, 90, 0);
-    Weapon::throwingknifemodel.flat = 0;
-    Weapon::throwingknifemodel.CalculateNormals(1);
-
-    Weapon::swordmodel.load("Models/Sword.solid");
-    Weapon::swordmodel.Scale(.001, .001, .001);
-    Weapon::swordmodel.Rotate(90, 0, 0);
-    Weapon::swordmodel.Rotate(0, 90, 0);
-    Weapon::swordmodel.Rotate(0, 0, 90);
-    Weapon::swordmodel.flat = 1;
-    Weapon::swordmodel.CalculateNormals(1);
-
-    Weapon::staffmodel.load("Models/Staff.solid");
-    Weapon::staffmodel.Scale(.005, .005, .005);
-    Weapon::staffmodel.Rotate(90, 0, 0);
-    Weapon::staffmodel.Rotate(0, 90, 0);
-    Weapon::staffmodel.Rotate(0, 0, 90);
-    Weapon::staffmodel.flat = 1;
-    Weapon::staffmodel.CalculateNormals(1);
+    Weapon::Load();
 
     terrain.shadowtexture.load("Textures/Shadow.png", 0);
     terrain.bloodtexture.load("Textures/Blood.png", 0);
index 5ef40e6ff08e47d17a8963419f2eed0e32c659f9..31ea8c16f4f76edcb3c8bb2948183ed14cb23baa 100644 (file)
@@ -97,6 +97,43 @@ void Weapon::setType(int t)
     }
 }
 
+/* Load weapons models and textures */
+void Weapon::Load()
+{
+    LOG("Loading weapon data...");
+
+    knifetextureptr.load("Textures/Knife.png", 0);
+    bloodknifetextureptr.load("Textures/BloodKnife.png", 0);
+    lightbloodknifetextureptr.load("Textures/BloodKnifeLight.png", 0);
+    swordtextureptr.load("Textures/Sword.jpg", 1);
+    bloodswordtextureptr.load("Textures/SwordBlood.jpg", 1);
+    lightbloodswordtextureptr.load("Textures/SwordBloodLight.jpg", 1);
+    stafftextureptr.load("Textures/Staff.jpg", 1);
+
+    throwingknifemodel.load("Models/ThrowingKnife.solid");
+    throwingknifemodel.Scale(.001, .001, .001);
+    throwingknifemodel.Rotate(90, 0, 0);
+    throwingknifemodel.Rotate(0, 90, 0);
+    throwingknifemodel.flat = 0;
+    throwingknifemodel.CalculateNormals(1);
+
+    swordmodel.load("Models/Sword.solid");
+    swordmodel.Scale(.001, .001, .001);
+    swordmodel.Rotate(90, 0, 0);
+    swordmodel.Rotate(0, 90, 0);
+    swordmodel.Rotate(0, 0, 90);
+    swordmodel.flat = 1;
+    swordmodel.CalculateNormals(1);
+
+    staffmodel.load("Models/Staff.solid");
+    staffmodel.Scale(.005, .005, .005);
+    staffmodel.Rotate(90, 0, 0);
+    staffmodel.Rotate(0, 90, 0);
+    staffmodel.Rotate(0, 0, 90);
+    staffmodel.flat = 1;
+    staffmodel.CalculateNormals(1);
+}
+
 void Weapon::DoStuff(int i)
 {
     static int whichpatchx, whichpatchz, whichhit;
index 2f802f742a14a089d8dd4558880faf519d2720ff..33d93aa9cbf724f62cfcc222665f186d91d9d44f 100644 (file)
@@ -57,6 +57,8 @@ public:
     static Model staffmodel;
     static Texture stafftextureptr;
 
+    static void Load();
+
     void Draw();
     void DoStuff(int);