X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FObjects.cpp;h=572f16ba6888f9124267d3725d14737ed1ae23f5;hb=5310d6ffd89fd8b981b273b332a232b70b4ce7ad;hp=3317992d97d8553b00fffbe3f2999a2450bdd048;hpb=8265984dce72d262e3865ebad4668d98b5b26d4a;p=lugaru.git diff --git a/Source/Objects.cpp b/Source/Objects.cpp index 3317992..572f16b 100644 --- a/Source/Objects.cpp +++ b/Source/Objects.cpp @@ -10,7 +10,7 @@ of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. @@ -22,7 +22,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "Objects.h" extern XYZ viewer; extern float viewdistance; -extern float lightambient[3],lightbrightness[3]; extern float fadestart; extern int environment; extern float texscale; @@ -31,7 +30,6 @@ extern float multiplier; extern float gravity; extern FRUSTUM frustum; extern Terrain terrain; -extern float terraindetail; extern bool foliage; extern int detail; extern float blurness; @@ -41,758 +39,820 @@ extern bool skyboxtexture; //Functions -bool Objects::checkcollide(XYZ startpoint,XYZ endpoint,int which){ - static XYZ colpoint,colviewer,coltarget; - static int i; - - startpoint.y+=.1; - endpoint.y+=.1; - startpoint.y-=.1; - endpoint.y-=.1; - - for(i=0;ix/(terrain.size/subdivision*terrain.scale*terraindetail); - whichpatchz=p1->z/(terrain.size/subdivision*terrain.scale*terraindetail); - - if(whichpatchx>=0&&whichpatchz>=0&&whichpatchx0&&terrain.patchobjectnum[whichpatchx][whichpatchz]<500) - for(j=0;jx / (terrain.size / subdivision * terrain.scale); + whichpatchz = p1->z / (terrain.size / subdivision * terrain.scale); + + if (whichpatchx >= 0 && whichpatchz >= 0 && whichpatchx < subdivision && whichpatchz < subdivision) + if (terrain.patchobjectnum[whichpatchx][whichpatchz] > 0 && terrain.patchobjectnum[whichpatchx][whichpatchz] < 500) + for (j = 0; j < terrain.patchobjectnum[whichpatchx][whichpatchz]; j++) { + i = terrain.patchobjects[whichpatchx][whichpatchz][j]; + possible[i] = 0; + if (model[i].SphereCheckPossible(p1, radius, &position[i], &yaw[i]) != -1) { + possible[i] = 1; + } + } } void Objects::Draw() { - static float distance; - static int i,j; - static XYZ moved,terrainlight; - bool hidden; - - for(i=0;i