]> git.jsancho.org Git - lugaru.git/blobdiff - Source/GameTick.cpp
Removed most of the commented out code
[lugaru.git] / Source / GameTick.cpp
index c5f953f502b44c2b7b3e87ad0a18928201e500e0..beb1733dac1cf4320a4721f0d2544be1abf21af6 100644 (file)
@@ -3,20 +3,18 @@ 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.
+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 <http://www.gnu.org/licenses/>.
 */
 
 // Enable full math definitions
@@ -1430,8 +1428,6 @@ int Game::checkcollide(XYZ startpoint, XYZ endpoint)
         }
     }
 
-    //if(terrain.lineTerrain(startpoint,endpoint,&colpoint)!=-1)return 1000;
-
     return -1;
 }
 
@@ -1731,9 +1727,6 @@ void Loadlevel(const char *name)
 
     int mapvers;
     FILE *tfile;
-    //~ char* buff=getcwd(NULL,0);
-    //~ cout << buff << " " << FixedFN << endl;
-    //~ free(buff);
     tfile = fopen( FixedFN, "rb" );
     if (tfile) {
         pause_sound(stream_firesound);
@@ -3224,10 +3217,7 @@ void doDebugKeys()
         }
 
         if (Input::isKeyPressed(SDL_SCANCODE_N) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
-            //if(!Person::players[0]->skeleton.free)Person::players[0]->damage+=500;
             Person::players[0]->RagDoll(0);
-            //Person::players[0]->spurt=1;
-            //Person::players[0]->DoDamage(1000);
 
             emit_sound_at(whooshsound, Person::players[0]->coords, 128.);
         }
@@ -3278,8 +3268,6 @@ void doDebugKeys()
             }
 
             if (Input::isKeyPressed(SDL_SCANCODE_M) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
-                //drawmode++;
-                //if(drawmode>2)drawmode=0;
                 if (objects.numobjects < max_objects - 1) {
                     XYZ boxcoords;
                     boxcoords.x = Person::players[0]->coords.x;
@@ -3714,7 +3702,6 @@ void doAerialAcrobatics()
             Person::players[k]->yaw = stepTowardf(Person::players[k]->yaw, Person::players[k]->targetyaw, multiplier * Person::players[k]->turnspeed * 4);
         }
 
-        /*if(Person::players[k]->aitype!=passivetype||(distsq(&Person::players[k]->coords,&viewer)<viewdistance*viewdistance))*/
         Person::players[k]->DoStuff();
         if (Person::players[k]->immobile && k != 0)
             Person::players[k]->coords = Person::players[k]->realoldcoords;
@@ -3890,7 +3877,7 @@ void doAerialAcrobatics()
                 }
             }
 
-            if (tempcollide && (/*Person::players[k]->jumptogglekeydown*/1 == 1 || Person::players[k]->aitype != playercontrolled))
+            if (tempcollide)
                 for (int l = 0; l < terrain.patchobjectnum[Person::players[k]->whichpatchx][Person::players[k]->whichpatchz]; l++) {
                     int i = terrain.patchobjects[Person::players[k]->whichpatchx][Person::players[k]->whichpatchz][l];
                     lowpoint = Person::players[k]->coords;
@@ -3972,7 +3959,6 @@ void doAerialAcrobatics()
                                                                 if (j <= 6 || j <= 25 && Person::players[k]->animTarget == jumpdownanim)
                                                                     break;
                                                                 if (Person::players[k]->animTarget == jumpupanim || Person::players[k]->animTarget == jumpdownanim) {
-                                                                    lowpoint = DoRotation(objects.model[i].facenormals[whichhit], 0, objects.yaw[k], 0);
                                                                     lowpoint = Person::players[k]->coords;
                                                                     lowpoint.y += (float)j / 13;
                                                                     lowpointtarget = lowpoint + facing * 1.3;
@@ -5489,7 +5475,7 @@ void doAI(unsigned i)
                     if (Person::players[0]->animTarget != rabbitkickanim && Person::players[0]->weaponactive != -1) {
                         if (weapons[Person::players[0]->weaponids[0]].getType() == knife) {
                             if (Person::players[i]->isIdle() || Person::players[i]->isCrouch() || Person::players[i]->isRun() || Person::players[i]->isFlip()) {
-                                if (abs(Random() % 2 == 0))
+                                if (abs(Random() % 2) == 0)
                                     Person::players[i]->setAnimation(backhandspringanim);
                                 else
                                     Person::players[i]->setAnimation(rollanim);
@@ -6689,7 +6675,6 @@ void Game::Tick()
                         hotspotvisual[i] -= multiplier / 320;
 
                 for (int i = 0; i < numhotspots; i++) {
-                    //if(hotspottype[i]<=10)
                     while (hotspotvisual[i] < 0) {
                         hotspotsprite = 0;
                         hotspotsprite.x = float(abs(Random() % 100000)) / 100000 * hotspotsize[i];
@@ -7198,7 +7183,6 @@ void Game::Tick()
                                  Person::players[i]->animTarget == rollanim ||
                                  Person::players[i]->animTarget == backhandspringanim ||
                                  Person::players[i]->isFlip() ||
-                                 Person::players[i]->isFlip() ||
                                  Person::players[i]->aitype != playercontrolled)) {
                             for (unsigned j = 0; j < weapons.size(); j++) {
                                 if ((weapons[j].velocity.x == 0 && weapons[j].velocity.y == 0 && weapons[j].velocity.z == 0 ||
@@ -8402,7 +8386,7 @@ void Game::TickOnceAfter()
             }
             target.y += .1;
         }
-        if (Person::players[0]->skeleton.free != 2/*&&!autocam*/) {
+        if (Person::players[0]->skeleton.free != 2) {
             cameraspeed = 20;
             if (findLengthfast(&Person::players[0]->velocity) > 400) {
                 cameraspeed = 20 + (findLength(&Person::players[0]->velocity) - 20) * .96;
@@ -8450,55 +8434,8 @@ void Game::TickOnceAfter()
                 cameraloc.y = terrain.getHeight(cameraloc.x, cameraloc.z);
             }
         }
-        /*
-        //what did autocam do?
-        if(Person::players[0]->skeleton.free!=2&&autocam){
-            cameraspeed=20;
-            if(findLengthfast(&Person::players[0]->velocity)>400){
-                cameraspeed=20+(findLength(&Person::players[0]->velocity)-20)*.96;
-            }
-            if(Person::players[0]->skeleton.free==0&&Person::players[0]->animTarget!=hanganim&&Person::players[0]->animTarget!=climbanim)target.y+=1.4;
-            cameradist+=multiplier*5;
-            if(cameradist>3.3)cameradist=3.3;
-            coltarget=target-cameraloc;
-            if(findLengthfast(&coltarget)<multiplier*multiplier*400)cameraloc=target;
-            else if(findLengthfast(&coltarget)>1)
-            {
-                Normalise(&coltarget);
-                if(Person::players[0]->animTarget!=hanganim&&Person::players[0]->animTarget!=climbanim&&Person::players[0]->animCurrent!=climbanim&&Person::players[0]->currentoffset.x==0)cameraloc=cameraloc+coltarget*multiplier*cameraspeed;
-                else cameraloc=cameraloc+coltarget*multiplier*8;
-            }
-            if(editorenabled)cameraloc=target;
-            viewer=cameraloc;
-            colviewer=viewer;
-            coltarget=cameraloc;
-            objects.SphereCheckPossible(&colviewer, findDistance(&colviewer,&coltarget));
-            if(terrain.patchobjectnum[Person::players[0]->whichpatchx][Person::players[0]->whichpatchz])
-                for(int j=0;j<terrain.patchobjectnum[Person::players[0]->whichpatchx][Person::players[0]->whichpatchz];j++){
-                    int i=terrain.patchobjects[Person::players[0]->whichpatchx][Person::players[0]->whichpatchz][j];
-                    colviewer=viewer;
-                    coltarget=cameraloc;
-                    if(objects.model[i].LineCheckPossible(&colviewer,&coltarget,&col,&objects.position[i],&objects.yaw[i])!=-1)viewer=col;
-                }
-            if(terrain.patchobjectnum[Person::players[0]->whichpatchx][Person::players[0]->whichpatchz])
-                for(int j=0;j<terrain.patchobjectnum[Person::players[0]->whichpatchx][Person::players[0]->whichpatchz];j++){
-                    int i=terrain.patchobjects[Person::players[0]->whichpatchx][Person::players[0]->whichpatchz][j];
-                    colviewer=viewer;
-                    if(objects.model[i].SphereCheck(&colviewer,.15,&col,&objects.position[i],&objects.yaw[i])!=-1){
-                        viewer=colviewer;
-                    }
-                }
-            cameradist=findDistance(&viewer,&target);
-            viewer.y=max((double)viewer.y,terrain.getHeight(viewer.x,viewer.z)+.6);
-            if(cameraloc.y<terrain.getHeight(cameraloc.x,cameraloc.z)){
-                cameraloc.y=terrain.getHeight(cameraloc.x,cameraloc.z);
-            }
-        }
-        */
         if (camerashake > .8)
             camerashake = .8;
-        //if(woozy>10)woozy=10;
-        //woozy+=multiplier;
         woozy += multiplier;
         if (Person::players[0]->dead)
             camerashake = 0;
@@ -8506,12 +8443,10 @@ void Game::TickOnceAfter()
             woozy = 0;
         camerashake -= multiplier * 2;
         blackout -= multiplier * 2;
-        //if(Person::players[0]->isCrouch())woozy-=multiplier*8;
         if (camerashake < 0)
             camerashake = 0;
         if (blackout < 0)
             blackout = 0;
-        //if(woozy<0)woozy=0;
         if (camerashake) {
             viewer.x += (float)(Random() % 100) * .0005 * camerashake;
             viewer.y += (float)(Random() % 100) * .0005 * camerashake;