]> git.jsancho.org Git - lugaru.git/blobdiff - Source/Objects.cpp
merge
[lugaru.git] / Source / Objects.cpp
index 9bf8397e05b39ad95d55ef5e7ec67234a572790a..a01fc1193598d379c0cc390c5fc7d7d53372ffec 100644 (file)
@@ -1,3 +1,24 @@
+/*
+Copyright (C) 2003, 2010 - Wolfire Games
+
+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.
+
+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.  
+
+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.
+*/
+
 #include "Objects.h"
 extern XYZ viewer;
 extern float viewdistance;
@@ -10,14 +31,12 @@ extern float multiplier;
 extern float gravity;
 extern FRUSTUM frustum;
 extern Terrain terrain;
-extern float terraindetail;
 extern bool foliage;
 extern int detail;
 extern float blurness;
 extern float windvar;
 extern float playerdist;
 extern bool skyboxtexture;
-extern Sprites sprites;
 
 //Functions
 
@@ -47,8 +66,8 @@ void Objects::SphereCheckPossible(XYZ *p1,float radius)
        static int whichpatchx;
        static int whichpatchz;
 
-       whichpatchx=p1->x/(terrain.size/subdivision*terrain.scale*terraindetail);
-       whichpatchz=p1->z/(terrain.size/subdivision*terrain.scale*terraindetail);
+       whichpatchx=p1->x/(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)
@@ -643,7 +662,7 @@ void Objects::DoStuff()
        XYZ spawnpoint;
        for(int i=0;i<numobjects;i++){
                /*if(type[i]==firetype){
-               sprites.MakeSprite(weaponshinesprite, position[i],position[i]*0, 1,1,1, 5, 1);
+               Sprite::MakeSprite(weaponshinesprite, position[i],position[i]*0, 1,1,1, 5, 1);
                }*/
 
                if(type[i]==firetype)onfire[i]=1;
@@ -659,7 +678,7 @@ void Objects::DoStuff()
                                        spawnpoint.z=0;
                                        spawnpoint=DoRotation(spawnpoint,0,Random()%360,0);
                                        spawnpoint+=position[i];
-                                       sprites.MakeSprite(flamesprite, spawnpoint,spawnpoint*0, 1,1,1, (.6+(float)abs(Random()%100)/200-.25)*5*scale[i], 1);
+                                       Sprite::MakeSprite(flamesprite, spawnpoint,spawnpoint*0, 1,1,1, (.6+(float)abs(Random()%100)/200-.25)*5*scale[i], 1);
                                }
                                if(type[i]==treeleavestype){
                                        spawnpoint.x=((float)(Random()%100))/80*scale[i];
@@ -667,7 +686,7 @@ void Objects::DoStuff()
                                        spawnpoint.z=0;
                                        spawnpoint=DoRotation(spawnpoint,0,Random()%360,0);
                                        spawnpoint+=position[i];
-                                       sprites.MakeSprite(flamesprite, spawnpoint,spawnpoint*0, 1,1,1, (.6+(float)abs(Random()%100)/200-.25)*6, 1);
+                                       Sprite::MakeSprite(flamesprite, spawnpoint,spawnpoint*0, 1,1,1, (.6+(float)abs(Random()%100)/200-.25)*6, 1);
                                }
                        }
 
@@ -693,8 +712,8 @@ void Objects::DoShadows()
                                        terrainpoint=position[i]+DoRotation(model[i].vertex[j]+model[i].normals[j]*.1,0,rotation[i],0);
                                        //terrainpoint.y+=model[i].boundingsphereradius;
                                        shadowed[i]=0;
-                                       patchx=terrainpoint.x/(terrain.size/subdivision*terrain.scale*terraindetail);
-                                       patchz=terrainpoint.z/(terrain.size/subdivision*terrain.scale*terraindetail);
+                                       patchx=terrainpoint.x/(terrain.size/subdivision*terrain.scale);
+                                       patchz=terrainpoint.z/(terrain.size/subdivision*terrain.scale);
                                        if(patchx>=0&&patchz>=0&&patchx<subdivision&&patchz<subdivision)
                                                if(terrain.patchobjectnum[patchx][patchz])
                                                        for(k=0;k<terrain.patchobjectnum[patchx][patchz];k++){