]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Terrain.cpp
Switched all data access to the new methods
[lugaru.git] / Source / Terrain.cpp
index 08a9f71111efa8242613c4df86efedfc250e4139..c395ebf0b03113e54324005b566ca3b7139ac08e 100644 (file)
@@ -1,5 +1,6 @@
 /*
 Copyright (C) 2003, 2010 - Wolfire Games
+Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file)
 
 This file is part of Lugaru.
 
@@ -20,6 +21,8 @@ along with Lugaru.  If not, see <http://www.gnu.org/licenses/>.
 #include "Game.h"
 #include "Terrain.h"
 #include "Objects.h"
+#include "Utils/Folders.h"
+
 extern XYZ viewer;
 extern float viewdistance;
 extern float fadestart;
@@ -34,7 +37,6 @@ extern bool decals;
 extern float blurness;
 extern float targetblurness;
 extern Objects objects;
-extern ImageRec texture;
 extern bool visibleloading;
 extern bool skyboxtexture;
 extern int tutoriallevel;
@@ -197,7 +199,6 @@ void Terrain::UpdateTransparency(int whichx, int whichy)
 
 void Terrain::UpdateTransparencyother(int whichx, int whichy)
 {
-    static XYZ vertex;
     static int i, j, a, b, c, d, patch_size, stepsize;
 
     patch_size = size / subdivision;
@@ -405,8 +406,10 @@ bool Terrain::load(const char *fileName)
 
     float temptexdetail = texdetail;
 
+    ImageRec texture;
+
     //Load Image
-    upload_image(ConvertFileName(fileName));
+    load_image(Folders::getResourcePath(fileName).c_str(), texture);
 
     //Is it valid?
     if (texture.bpp > 24) {
@@ -802,7 +805,7 @@ void Terrain::drawpatchotherother(int whichx, int whichy, float opacity)
 float Terrain::getHeight(float pointx, float pointz)
 {
     static int tilex, tiley;
-    static XYZ startpoint, endpoint, intersect, triangle[3], average;
+    static XYZ startpoint, endpoint, intersect, triangle[3];
 
     pointx /= scale;
     pointz /= scale;