X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FEnvironment%2FTerrain.cpp;h=ba4e24024b397447b91ea4a6e65ac04e7dea22a3;hb=e66f03512f2e3471462c3927f47e464711eb7ae8;hp=164dce38fd6a02739d221c4e5282204584d6283a;hpb=ed3662c0852c4312a612b4fc35bd03aba8d13db7;p=lugaru.git diff --git a/Source/Environment/Terrain.cpp b/Source/Environment/Terrain.cpp index 164dce3..ba4e240 100644 --- a/Source/Environment/Terrain.cpp +++ b/Source/Environment/Terrain.cpp @@ -21,8 +21,9 @@ along with Lugaru. If not, see . #include "Environment/Terrain.hpp" #include "Game.hpp" -#include "Objects/Objects.hpp" +#include "Objects/Object.hpp" #include "Utils/Folders.hpp" +#include "Tutorial.hpp" extern XYZ viewer; extern float viewdistance; @@ -37,10 +38,7 @@ extern int detail; extern bool decals; extern float blurness; extern float targetblurness; -extern Objects objects; -extern bool visibleloading; extern bool skyboxtexture; -extern int tutoriallevel; //Functions @@ -427,8 +425,7 @@ bool Terrain::load(const std::string& fileName) } } texture.bpp = 24; - if (visibleloading) - Game::LoadingScreen(); + Game::LoadingScreen(); texdetail = temptexdetail; @@ -440,8 +437,7 @@ bool Terrain::load(const std::string& fileName) } } - if (visibleloading) - Game::LoadingScreen(); + Game::LoadingScreen(); float slopeness; @@ -450,8 +446,7 @@ bool Terrain::load(const std::string& fileName) textureness[i][j] = -1; } } - if (visibleloading) - Game::LoadingScreen(); + Game::LoadingScreen(); for (i = 0; i < size; i++) { @@ -500,8 +495,7 @@ bool Terrain::load(const std::string& fileName) } } } - if (visibleloading) - Game::LoadingScreen(); + Game::LoadingScreen(); for (i = 0; i < size; i++) { for (j = 0; j < size; j++) { @@ -513,8 +507,7 @@ bool Terrain::load(const std::string& fileName) } } } - if (visibleloading) - Game::LoadingScreen(); + Game::LoadingScreen(); for (i = 0; i < size; i++) { for (j = 0; j < size; j++) { @@ -639,8 +632,7 @@ bool Terrain::load(const std::string& fileName) } } } - if (visibleloading) - Game::LoadingScreen(); + Game::LoadingScreen(); patch_size = size / subdivision; patch_elements = (patch_size) * (patch_size) * 54; @@ -733,7 +725,9 @@ void Terrain::drawpatch(int whichx, int whichy, float opacity) glEnable(GL_BLEND); UpdateTransparency(whichx, whichy); } + glColor4f(1, 1, 1, 1); + //Set up vertex array glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_COLOR_ARRAY); @@ -757,7 +751,9 @@ void Terrain::drawpatchother(int whichx, int whichy, float opacity) UpdateTransparency(whichx, whichy); } UpdateTransparencyother(whichx, whichy); + glColor4f(1, 1, 1, 1); + //Set up vertex array glEnableClientState(GL_VERTEX_ARRAY); glEnableClientState(GL_COLOR_ARRAY); @@ -1367,7 +1363,7 @@ void Terrain::DoShadows() lightloc.x = 0; lightloc.z = 0; } - if (skyboxtexture && tutoriallevel) { + if (skyboxtexture && Tutorial::active) { lightloc.x *= .4; lightloc.z *= .4; } @@ -1387,16 +1383,15 @@ void Terrain::DoShadows() if (patchobjectnum[patchx][patchz]) { for (k = 0; k < patchobjectnum[patchx][patchz]; k++) { l = patchobjects[patchx][patchz][k]; - if (objects.type[l] != treetrunktype) { + if (Object::objects[l]->type != treetrunktype) { testpoint = terrainpoint; testpoint2 = terrainpoint + lightloc * 50 * (1 - shadowed); - if (objects.model[l].LineCheck(&testpoint, &testpoint2, &col, &objects.position[l], &objects.yaw[l]) != -1) { + if (Object::objects[l]->model.LineCheck(&testpoint, &testpoint2, &col, &Object::objects[l]->position, &Object::objects[l]->yaw) != -1) { shadowed = 1 - (findDistance(&terrainpoint, &col) / 50); } } } - if (visibleloading) - Game::LoadingScreen(); + Game::LoadingScreen(); } brightness = dotproduct(&lightloc, &normals[i][j]); if (shadowed) @@ -1420,8 +1415,7 @@ void Terrain::DoShadows() } } - if (visibleloading) - Game::LoadingScreen(); + Game::LoadingScreen(); //Smooth shadows for (i = 0; i < size; i++) { @@ -1516,14 +1510,3 @@ Terrain::Terrain() memset(decalposition, 0, sizeof(decalposition)); numdecals = 0; } -Terrain::~Terrain() -{ - terraintexture.destroy(); - shadowtexture.destroy(); - bodyprinttexture.destroy(); - footprinttexture.destroy(); - bloodtexture.destroy(); - bloodtexture2.destroy(); - breaktexture.destroy(); -} -