X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FTerrain.cpp;h=41a2181cacefe40556cec8b44fe5ca731f375733;hb=8a6a4b71914b97fb154abdceef4db768633e71df;hp=8c0335c8a8872b8f2dd4250be708c56a8c9c0e9d;hpb=5509b55dbc13227bdc7b97f2934fa71dad02cc66;p=lugaru.git diff --git a/Source/Terrain.cpp b/Source/Terrain.cpp index 8c0335c..41a2181 100644 --- a/Source/Terrain.cpp +++ b/Source/Terrain.cpp @@ -21,6 +21,8 @@ along with Lugaru. If not, see . #include "Game.h" #include "Terrain.h" #include "Objects.h" +#include "Utils/Folders.h" + extern XYZ viewer; extern float viewdistance; extern float fadestart; @@ -35,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; @@ -198,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; @@ -406,8 +406,12 @@ bool Terrain::load(const char *fileName) float temptexdetail = texdetail; + ImageRec texture; + //Load Image - upload_image(ConvertFileName(fileName)); + if (!load_image(Folders::getResourcePath(fileName).c_str(), texture)) { + return false; + } //Is it valid? if (texture.bpp > 24) { @@ -641,7 +645,7 @@ bool Terrain::load(const char *fileName) patch_elements = (patch_size) * (patch_size) * 54; CalculateNormals(); - return 1; + return true; } void Terrain::CalculateNormals() @@ -803,7 +807,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;