X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=Source%2FObjects.cpp;h=1a974be750cfb5be564aa5b80f619375a6c4c268;hb=5509b55dbc13227bdc7b97f2934fa71dad02cc66;hp=8f2544f905df5a3666839c95130deaf479d75263;hpb=35b5d8a643d2ff04614a8b9f57026b57d4a82667;p=lugaru.git diff --git a/Source/Objects.cpp b/Source/Objects.cpp index 8f2544f..1a974be 100644 --- a/Source/Objects.cpp +++ b/Source/Objects.cpp @@ -1,22 +1,21 @@ /* Copyright (C) 2003, 2010 - Wolfire Games +Copyright (C) 2010-2016 - Lugaru contributors (see AUTHORS file) This file is part of Lugaru. -Lugaru is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License -as published by the Free Software Foundation; either version 2 -of the License, or (at your option) any later version. +Lugaru is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. -This program is distributed in the hope that it will be useful, +Lugaru 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. - -See the GNU General Public License for more details. +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +GNU General Public License for more details. You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +along with Lugaru. If not, see . */ #include "Objects.h" @@ -39,747 +38,798 @@ 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); - whichpatchz=p1->z/(terrain.size/subdivision*terrain.scale); - - 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