]> git.jsancho.org Git - lugaru.git/commitdiff
Debug mode is now a comandline option
authorCôme Chilliet <come@chilliet.eu>
Sat, 10 Dec 2016 04:11:30 +0000 (11:11 +0700)
committerCôme Chilliet <come@chilliet.eu>
Sat, 10 Dec 2016 04:11:30 +0000 (11:11 +0700)
Source/Game.h
Source/GameTick.cpp
Source/Settings.cpp
Source/main.cpp

index 5526681c5900ec6c9018fe0cedc18fe1e1000f4b..6d46ff4954535ecc9638b7fc19fd1d977e487d72 100644 (file)
@@ -218,11 +218,11 @@ SDL_bool sdlEventProc(const SDL_Event &e);
 
 
 
-enum  optionIndex { UNKNOWN, HELP, FULLSCREEN, NOMOUSEGRAB, SOUND, OPENALINFO, SHOWRESOLUTIONS };
+enum  optionIndex { UNKNOWN, HELP, FULLSCREEN, NOMOUSEGRAB, SOUND, OPENALINFO, SHOWRESOLUTIONS, DEBUG };
 /* Number of options + 1 */
-const int commandLineOptionsNumber = 8;
+const int commandLineOptionsNumber = 9;
 
-extern const option::Descriptor usage[12];
+extern const option::Descriptor usage[13];
 
 extern option::Option commandLineOptions[commandLineOptionsNumber];
 extern option::Option* commandLineOptionsBuffer;
index 13eb1cbff770768c09f14b06622ef81508e62a93..d10fc3fbd7fa5cd66916dd009adbc02e8ac413e6 100644 (file)
@@ -1771,631 +1771,632 @@ void doTutorial()
 void doDebugKeys()
 {
     float headprop, bodyprop, armprop, legprop;
-    if (debugmode) {
-        if (Input::isKeyPressed(SDL_SCANCODE_H)) {
-            Person::players[0]->damagetolerance = 200000;
-            Person::players[0]->damage = 0;
-            Person::players[0]->burnt = 0;
-            Person::players[0]->permanentdamage = 0;
-            Person::players[0]->superpermanentdamage = 0;
-        }
+    if (!debugmode) {
+        return;
+    }
+    if (Input::isKeyPressed(SDL_SCANCODE_H)) {
+        Person::players[0]->damagetolerance = 200000;
+        Person::players[0]->damage = 0;
+        Person::players[0]->burnt = 0;
+        Person::players[0]->permanentdamage = 0;
+        Person::players[0]->superpermanentdamage = 0;
+    }
 
-        if (Input::isKeyPressed(SDL_SCANCODE_J)) {
-            environment++;
-            if (environment > 2)
-                environment = 0;
-            Setenvironment(environment);
-        }
+    if (Input::isKeyPressed(SDL_SCANCODE_J)) {
+        environment++;
+        if (environment > 2)
+            environment = 0;
+        Setenvironment(environment);
+    }
 
-        if (Input::isKeyPressed(SDL_SCANCODE_C)) {
-            cameramode = !cameramode;
+    if (Input::isKeyPressed(SDL_SCANCODE_C)) {
+        cameramode = !cameramode;
+    }
+
+    if (Input::isKeyPressed(SDL_SCANCODE_X) && !Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
+        if (Person::players[0]->num_weapons > 0) {
+            if (weapons[Person::players[0]->weaponids[0]].getType() == sword)
+                weapons[Person::players[0]->weaponids[0]].setType(staff);
+            else if (weapons[Person::players[0]->weaponids[0]].getType() == staff)
+                weapons[Person::players[0]->weaponids[0]].setType(knife);
+            else
+                weapons[Person::players[0]->weaponids[0]].setType(sword);
         }
+    }
 
-        if (Input::isKeyPressed(SDL_SCANCODE_X) && !Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
-            if (Person::players[0]->num_weapons > 0) {
-                if (weapons[Person::players[0]->weaponids[0]].getType() == sword)
-                    weapons[Person::players[0]->weaponids[0]].setType(staff);
-                else if (weapons[Person::players[0]->weaponids[0]].getType() == staff)
-                    weapons[Person::players[0]->weaponids[0]].setType(knife);
+    if (Input::isKeyPressed(SDL_SCANCODE_X) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
+        int closest = findClosestPlayer();
+        if (closest >= 0) {
+            if (Person::players[closest]->num_weapons) {
+                if (weapons[Person::players[closest]->weaponids[0]].getType() == sword)
+                    weapons[Person::players[closest]->weaponids[0]].setType(staff);
+                else if (weapons[Person::players[closest]->weaponids[0]].getType() == staff)
+                    weapons[Person::players[closest]->weaponids[0]].setType(knife);
                 else
-                    weapons[Person::players[0]->weaponids[0]].setType(sword);
+                    weapons[Person::players[closest]->weaponids[0]].setType(sword);
             }
-        }
-
-        if (Input::isKeyPressed(SDL_SCANCODE_X) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
-            int closest = findClosestPlayer();
-            if (closest >= 0) {
-                if (Person::players[closest]->num_weapons) {
-                    if (weapons[Person::players[closest]->weaponids[0]].getType() == sword)
-                        weapons[Person::players[closest]->weaponids[0]].setType(staff);
-                    else if (weapons[Person::players[closest]->weaponids[0]].getType() == staff)
-                        weapons[Person::players[closest]->weaponids[0]].setType(knife);
-                    else
-                        weapons[Person::players[closest]->weaponids[0]].setType(sword);
-                }
-                if (!Person::players[closest]->num_weapons) {
-                    Person::players[closest]->weaponids[0] = weapons.size();
+            if (!Person::players[closest]->num_weapons) {
+                Person::players[closest]->weaponids[0] = weapons.size();
 
-                    weapons.push_back(Weapon(knife, closest));
+                weapons.push_back(Weapon(knife, closest));
 
-                    Person::players[closest]->num_weapons = 1;
-                }
+                Person::players[closest]->num_weapons = 1;
             }
         }
+    }
 
-        if (Input::isKeyDown(SDL_SCANCODE_U)) {
-            int closest = findClosestPlayer();
-            if (closest >= 0) {
-                Person::players[closest]->yaw += multiplier * 50;
-                Person::players[closest]->targetyaw = Person::players[closest]->yaw;
-            }
+    if (Input::isKeyDown(SDL_SCANCODE_U)) {
+        int closest = findClosestPlayer();
+        if (closest >= 0) {
+            Person::players[closest]->yaw += multiplier * 50;
+            Person::players[closest]->targetyaw = Person::players[closest]->yaw;
         }
+    }
 
 
-        if (Input::isKeyPressed(SDL_SCANCODE_O) && !Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
-            int closest = findClosestPlayer();
-            if (Input::isKeyDown(SDL_SCANCODE_LCTRL))
-                closest = 0;
+    if (Input::isKeyPressed(SDL_SCANCODE_O) && !Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
+        int closest = findClosestPlayer();
+        if (Input::isKeyDown(SDL_SCANCODE_LCTRL))
+            closest = 0;
 
-            if (closest >= 0) {
-                Person::players[closest]->whichskin++;
-                if (Person::players[closest]->whichskin > 9)
-                    Person::players[closest]->whichskin = 0;
-                if (Person::players[closest]->whichskin > 2 && Person::players[closest]->creature == wolftype)
-                    Person::players[closest]->whichskin = 0;
-
-                Person::players[closest]->skeleton.drawmodel.textureptr.load(creatureskin[Person::players[closest]->creature][Person::players[closest]->whichskin], 1,
-                        &Person::players[closest]->skeleton.skinText[0], &Person::players[closest]->skeleton.skinsize);
-            }
+        if (closest >= 0) {
+            Person::players[closest]->whichskin++;
+            if (Person::players[closest]->whichskin > 9)
+                Person::players[closest]->whichskin = 0;
+            if (Person::players[closest]->whichskin > 2 && Person::players[closest]->creature == wolftype)
+                Person::players[closest]->whichskin = 0;
 
-            Person::players[closest]->addClothes();
+            Person::players[closest]->skeleton.drawmodel.textureptr.load(creatureskin[Person::players[closest]->creature][Person::players[closest]->whichskin], 1,
+                    &Person::players[closest]->skeleton.skinText[0], &Person::players[closest]->skeleton.skinsize);
         }
 
-        if (Input::isKeyPressed(SDL_SCANCODE_O) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
-            int closest = findClosestPlayer();
-            if (closest >= 0) {
-                if (Person::players[closest]->creature == wolftype) {
-                    headprop = Person::players[closest]->proportionhead.x / 1.1;
-                    bodyprop = Person::players[closest]->proportionbody.x / 1.1;
-                    armprop = Person::players[closest]->proportionarms.x / 1.1;
-                    legprop = Person::players[closest]->proportionlegs.x / 1.1;
-                }
+        Person::players[closest]->addClothes();
+    }
 
-                if (Person::players[closest]->creature == rabbittype) {
-                    headprop = Person::players[closest]->proportionhead.x / 1.2;
-                    bodyprop = Person::players[closest]->proportionbody.x / 1.05;
-                    armprop = Person::players[closest]->proportionarms.x / 1.00;
-                    legprop = Person::players[closest]->proportionlegs.x / 1.1;
-                }
+    if (Input::isKeyPressed(SDL_SCANCODE_O) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
+        int closest = findClosestPlayer();
+        if (closest >= 0) {
+            if (Person::players[closest]->creature == wolftype) {
+                headprop = Person::players[closest]->proportionhead.x / 1.1;
+                bodyprop = Person::players[closest]->proportionbody.x / 1.1;
+                armprop = Person::players[closest]->proportionarms.x / 1.1;
+                legprop = Person::players[closest]->proportionlegs.x / 1.1;
+            }
 
+            if (Person::players[closest]->creature == rabbittype) {
+                headprop = Person::players[closest]->proportionhead.x / 1.2;
+                bodyprop = Person::players[closest]->proportionbody.x / 1.05;
+                armprop = Person::players[closest]->proportionarms.x / 1.00;
+                legprop = Person::players[closest]->proportionlegs.x / 1.1;
+            }
 
-                if (Person::players[closest]->creature == rabbittype) {
-                    Person::players[closest]->creature = wolftype;
-                    Person::players[closest]->whichskin = 0;
-                    Person::players[closest]->skeletonLoad();
 
-                    Person::players[closest]->proportionhead = 1.1;
-                    Person::players[closest]->proportionbody = 1.1;
-                    Person::players[closest]->proportionarms = 1.1;
-                    Person::players[closest]->proportionlegs = 1.1;
-                    Person::players[closest]->proportionlegs.y = 1.1;
-                    Person::players[closest]->scale = .23 * 5 * Person::players[0]->scale;
+            if (Person::players[closest]->creature == rabbittype) {
+                Person::players[closest]->creature = wolftype;
+                Person::players[closest]->whichskin = 0;
+                Person::players[closest]->skeletonLoad();
 
-                    Person::players[closest]->damagetolerance = 300;
-                } else {
-                    Person::players[closest]->creature = rabbittype;
-                    Person::players[closest]->whichskin = 0;
-                    Person::players[closest]->skeletonLoad(true);
-
-                    Person::players[closest]->proportionhead = 1.2;
-                    Person::players[closest]->proportionbody = 1.05;
-                    Person::players[closest]->proportionarms = 1.00;
-                    Person::players[closest]->proportionlegs = 1.1;
-                    Person::players[closest]->proportionlegs.y = 1.05;
-                    Person::players[closest]->scale = .2 * 5 * Person::players[0]->scale;
-
-                    Person::players[closest]->damagetolerance = 200;
-                }
+                Person::players[closest]->proportionhead = 1.1;
+                Person::players[closest]->proportionbody = 1.1;
+                Person::players[closest]->proportionarms = 1.1;
+                Person::players[closest]->proportionlegs = 1.1;
+                Person::players[closest]->proportionlegs.y = 1.1;
+                Person::players[closest]->scale = .23 * 5 * Person::players[0]->scale;
 
-                if (Person::players[closest]->creature == wolftype) {
-                    Person::players[closest]->proportionhead = 1.1 * headprop;
-                    Person::players[closest]->proportionbody = 1.1 * bodyprop;
-                    Person::players[closest]->proportionarms = 1.1 * armprop;
-                    Person::players[closest]->proportionlegs = 1.1 * legprop;
-                }
+                Person::players[closest]->damagetolerance = 300;
+            } else {
+                Person::players[closest]->creature = rabbittype;
+                Person::players[closest]->whichskin = 0;
+                Person::players[closest]->skeletonLoad(true);
+
+                Person::players[closest]->proportionhead = 1.2;
+                Person::players[closest]->proportionbody = 1.05;
+                Person::players[closest]->proportionarms = 1.00;
+                Person::players[closest]->proportionlegs = 1.1;
+                Person::players[closest]->proportionlegs.y = 1.05;
+                Person::players[closest]->scale = .2 * 5 * Person::players[0]->scale;
+
+                Person::players[closest]->damagetolerance = 200;
+            }
 
-                if (Person::players[closest]->creature == rabbittype) {
-                    Person::players[closest]->proportionhead = 1.2 * headprop;
-                    Person::players[closest]->proportionbody = 1.05 * bodyprop;
-                    Person::players[closest]->proportionarms = 1.00 * armprop;
-                    Person::players[closest]->proportionlegs = 1.1 * legprop;
-                    Person::players[closest]->proportionlegs.y = 1.05 * legprop;
-                }
+            if (Person::players[closest]->creature == wolftype) {
+                Person::players[closest]->proportionhead = 1.1 * headprop;
+                Person::players[closest]->proportionbody = 1.1 * bodyprop;
+                Person::players[closest]->proportionarms = 1.1 * armprop;
+                Person::players[closest]->proportionlegs = 1.1 * legprop;
+            }
 
+            if (Person::players[closest]->creature == rabbittype) {
+                Person::players[closest]->proportionhead = 1.2 * headprop;
+                Person::players[closest]->proportionbody = 1.05 * bodyprop;
+                Person::players[closest]->proportionarms = 1.00 * armprop;
+                Person::players[closest]->proportionlegs = 1.1 * legprop;
+                Person::players[closest]->proportionlegs.y = 1.05 * legprop;
             }
-        }
 
-        if (Input::isKeyPressed(SDL_SCANCODE_B) && !Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
-            slomo = 1 - slomo;
-            slomodelay = 1000;
         }
+    }
 
+    if (Input::isKeyPressed(SDL_SCANCODE_B) && !Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
+        slomo = 1 - slomo;
+        slomodelay = 1000;
+    }
 
-        if (((Input::isKeyPressed(SDL_SCANCODE_I) && !Input::isKeyDown(SDL_SCANCODE_LSHIFT)))) {
-            int closest = -1;
-            float closestdist = std::numeric_limits<float>::max();
 
-            for (unsigned i = 1; i < Person::players.size(); i++) {
-                float distance = distsq(&Person::players[i]->coords, &Person::players[0]->coords);
-                if (!Person::players[i]->headless)
-                    if (distance < closestdist) {
-                        closestdist = distance;
-                        closest = i;
-                    }
-            }
+    if (((Input::isKeyPressed(SDL_SCANCODE_I) && !Input::isKeyDown(SDL_SCANCODE_LSHIFT)))) {
+        int closest = -1;
+        float closestdist = std::numeric_limits<float>::max();
 
-            XYZ flatfacing2, flatvelocity2;
-            XYZ blah;
-            if (closest != -1 && distsq(&Person::players[closest]->coords, &Person::players[0]->coords) < 144) {
-                blah = Person::players[closest]->coords;
-                XYZ headspurtdirection;
-                //int i = Person::players[closest]->skeleton.jointlabels[head];
-                Joint& headjoint = Person::players[closest]->joint(head);
-                for (int k = 0; k < Person::players[closest]->skeleton.joints.size(); k++) {
-                    if (!Person::players[closest]->skeleton.free)
-                        flatvelocity2 = Person::players[closest]->velocity;
-                    if (Person::players[closest]->skeleton.free)
-                        flatvelocity2 = headjoint.velocity;
-                    if (!Person::players[closest]->skeleton.free)
-                        flatfacing2 = DoRotation(DoRotation(DoRotation(headjoint.position, 0, 0, Person::players[closest]->tilt), Person::players[closest]->tilt2, 0, 0), 0, Person::players[closest]->yaw, 0) * Person::players[closest]->scale + Person::players[closest]->coords;
-                    if (Person::players[closest]->skeleton.free)
-                        flatfacing2 = headjoint.position * Person::players[closest]->scale + Person::players[closest]->coords;
-                    flatvelocity2.x += (float)(abs(Random() % 100) - 50) / 10;
-                    flatvelocity2.y += (float)(abs(Random() % 100) - 50) / 10;
-                    flatvelocity2.z += (float)(abs(Random() % 100) - 50) / 10;
-                    headspurtdirection = headjoint.position - Person::players[closest]->jointPos(neck);
-                    Normalise(&headspurtdirection);
-                    Sprite::MakeSprite(bloodflamesprite, flatfacing2, flatvelocity2, 1, 1, 1, .6, 1);
-                    flatvelocity2 += headspurtdirection * 8;
-                    Sprite::MakeSprite(bloodsprite, flatfacing2, flatvelocity2 / 2, 1, 1, 1, .16, 1);
+        for (unsigned i = 1; i < Person::players.size(); i++) {
+            float distance = distsq(&Person::players[i]->coords, &Person::players[0]->coords);
+            if (!Person::players[i]->headless)
+                if (distance < closestdist) {
+                    closestdist = distance;
+                    closest = i;
                 }
-                Sprite::MakeSprite(cloudsprite, flatfacing2, flatvelocity2 * 0, .6, 0, 0, 1, .5);
+        }
 
-                emit_sound_at(splattersound, blah);
-                emit_sound_at(breaksound2, blah, 100.);
+        XYZ flatfacing2, flatvelocity2;
+        XYZ blah;
+        if (closest != -1 && distsq(&Person::players[closest]->coords, &Person::players[0]->coords) < 144) {
+            blah = Person::players[closest]->coords;
+            XYZ headspurtdirection;
+            //int i = Person::players[closest]->skeleton.jointlabels[head];
+            Joint& headjoint = Person::players[closest]->joint(head);
+            for (int k = 0; k < Person::players[closest]->skeleton.joints.size(); k++) {
+                if (!Person::players[closest]->skeleton.free)
+                    flatvelocity2 = Person::players[closest]->velocity;
+                if (Person::players[closest]->skeleton.free)
+                    flatvelocity2 = headjoint.velocity;
+                if (!Person::players[closest]->skeleton.free)
+                    flatfacing2 = DoRotation(DoRotation(DoRotation(headjoint.position, 0, 0, Person::players[closest]->tilt), Person::players[closest]->tilt2, 0, 0), 0, Person::players[closest]->yaw, 0) * Person::players[closest]->scale + Person::players[closest]->coords;
+                if (Person::players[closest]->skeleton.free)
+                    flatfacing2 = headjoint.position * Person::players[closest]->scale + Person::players[closest]->coords;
+                flatvelocity2.x += (float)(abs(Random() % 100) - 50) / 10;
+                flatvelocity2.y += (float)(abs(Random() % 100) - 50) / 10;
+                flatvelocity2.z += (float)(abs(Random() % 100) - 50) / 10;
+                headspurtdirection = headjoint.position - Person::players[closest]->jointPos(neck);
+                Normalise(&headspurtdirection);
+                Sprite::MakeSprite(bloodflamesprite, flatfacing2, flatvelocity2, 1, 1, 1, .6, 1);
+                flatvelocity2 += headspurtdirection * 8;
+                Sprite::MakeSprite(bloodsprite, flatfacing2, flatvelocity2 / 2, 1, 1, 1, .16, 1);
+            }
+            Sprite::MakeSprite(cloudsprite, flatfacing2, flatvelocity2 * 0, .6, 0, 0, 1, .5);
 
-                if (Person::players[closest]->skeleton.free == 2)
-                    Person::players[closest]->skeleton.free = 0;
-                Person::players[closest]->RagDoll(0);
-                Person::players[closest]->dead = 2;
-                Person::players[closest]->headless = 1;
-                Person::players[closest]->DoBloodBig(3, 165);
+            emit_sound_at(splattersound, blah);
+            emit_sound_at(breaksound2, blah, 100.);
 
-                camerashake += .3;
-            }
+            if (Person::players[closest]->skeleton.free == 2)
+                Person::players[closest]->skeleton.free = 0;
+            Person::players[closest]->RagDoll(0);
+            Person::players[closest]->dead = 2;
+            Person::players[closest]->headless = 1;
+            Person::players[closest]->DoBloodBig(3, 165);
+
+            camerashake += .3;
         }
+    }
 
-        if (((Input::isKeyPressed(SDL_SCANCODE_I) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)))) {
-            int closest = findClosestPlayer();
-            XYZ flatfacing2, flatvelocity2;
-            XYZ blah;
-            if (closest >= 0 && distsq(&Person::players[closest]->coords, &Person::players[0]->coords) < 144) {
-                blah = Person::players[closest]->coords;
-                emit_sound_at(splattersound, blah);
-                emit_sound_at(breaksound2, blah);
-
-                for (int i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) {
-                    if (!Person::players[closest]->skeleton.free)
-                        flatvelocity2 = Person::players[closest]->velocity;
-                    if (Person::players[closest]->skeleton.free)
-                        flatvelocity2 = Person::players[closest]->skeleton.joints[i].velocity;
-                    if (!Person::players[closest]->skeleton.free)
-                        flatfacing2 = DoRotation(DoRotation(DoRotation(Person::players[closest]->skeleton.joints[i].position, 0, 0, Person::players[closest]->tilt), Person::players[closest]->tilt2, 0, 0), 0, Person::players[closest]->yaw, 0) * Person::players[closest]->scale + Person::players[closest]->coords;
-                    if (Person::players[closest]->skeleton.free)
-                        flatfacing2 = Person::players[closest]->skeleton.joints[i].position * Person::players[closest]->scale + Person::players[closest]->coords;
-                    flatvelocity2.x += (float)(abs(Random() % 100) - 50) / 10;
-                    flatvelocity2.y += (float)(abs(Random() % 100) - 50) / 10;
-                    flatvelocity2.z += (float)(abs(Random() % 100) - 50) / 10;
-                    Sprite::MakeSprite(bloodflamesprite, flatfacing2, flatvelocity2, 1, 1, 1, 3, 1);
-                    Sprite::MakeSprite(bloodsprite, flatfacing2, flatvelocity2, 1, 1, 1, .3, 1);
-                    Sprite::MakeSprite(cloudsprite, flatfacing2, flatvelocity2 * 0, .6, 0, 0, 1, .5);
-                }
+    if (((Input::isKeyPressed(SDL_SCANCODE_I) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)))) {
+        int closest = findClosestPlayer();
+        XYZ flatfacing2, flatvelocity2;
+        XYZ blah;
+        if (closest >= 0 && distsq(&Person::players[closest]->coords, &Person::players[0]->coords) < 144) {
+            blah = Person::players[closest]->coords;
+            emit_sound_at(splattersound, blah);
+            emit_sound_at(breaksound2, blah);
+
+            for (int i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) {
+                if (!Person::players[closest]->skeleton.free)
+                    flatvelocity2 = Person::players[closest]->velocity;
+                if (Person::players[closest]->skeleton.free)
+                    flatvelocity2 = Person::players[closest]->skeleton.joints[i].velocity;
+                if (!Person::players[closest]->skeleton.free)
+                    flatfacing2 = DoRotation(DoRotation(DoRotation(Person::players[closest]->skeleton.joints[i].position, 0, 0, Person::players[closest]->tilt), Person::players[closest]->tilt2, 0, 0), 0, Person::players[closest]->yaw, 0) * Person::players[closest]->scale + Person::players[closest]->coords;
+                if (Person::players[closest]->skeleton.free)
+                    flatfacing2 = Person::players[closest]->skeleton.joints[i].position * Person::players[closest]->scale + Person::players[closest]->coords;
+                flatvelocity2.x += (float)(abs(Random() % 100) - 50) / 10;
+                flatvelocity2.y += (float)(abs(Random() % 100) - 50) / 10;
+                flatvelocity2.z += (float)(abs(Random() % 100) - 50) / 10;
+                Sprite::MakeSprite(bloodflamesprite, flatfacing2, flatvelocity2, 1, 1, 1, 3, 1);
+                Sprite::MakeSprite(bloodsprite, flatfacing2, flatvelocity2, 1, 1, 1, .3, 1);
+                Sprite::MakeSprite(cloudsprite, flatfacing2, flatvelocity2 * 0, .6, 0, 0, 1, .5);
+            }
 
-                for (int i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) {
-                    if (!Person::players[closest]->skeleton.free)
-                        flatvelocity2 = Person::players[closest]->velocity;
-                    if (Person::players[closest]->skeleton.free)
-                        flatvelocity2 = Person::players[closest]->skeleton.joints[i].velocity;
-                    if (!Person::players[closest]->skeleton.free)
-                        flatfacing2 = DoRotation(DoRotation(DoRotation(Person::players[closest]->skeleton.joints[i].position, 0, 0, Person::players[closest]->tilt), Person::players[closest]->tilt2, 0, 0), 0, Person::players[closest]->yaw, 0) * Person::players[closest]->scale + Person::players[closest]->coords;
-                    if (Person::players[closest]->skeleton.free)
-                        flatfacing2 = Person::players[closest]->skeleton.joints[i].position * Person::players[closest]->scale + Person::players[closest]->coords;
-                    flatvelocity2.x += (float)(abs(Random() % 100) - 50) / 10;
-                    flatvelocity2.y += (float)(abs(Random() % 100) - 50) / 10;
-                    flatvelocity2.z += (float)(abs(Random() % 100) - 50) / 10;
-                    Sprite::MakeSprite(bloodflamesprite, flatfacing2, flatvelocity2, 1, 1, 1, 3, 1);
-                    Sprite::MakeSprite(bloodsprite, flatfacing2, flatvelocity2, 1, 1, 1, .4, 1);
-                }
+            for (int i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) {
+                if (!Person::players[closest]->skeleton.free)
+                    flatvelocity2 = Person::players[closest]->velocity;
+                if (Person::players[closest]->skeleton.free)
+                    flatvelocity2 = Person::players[closest]->skeleton.joints[i].velocity;
+                if (!Person::players[closest]->skeleton.free)
+                    flatfacing2 = DoRotation(DoRotation(DoRotation(Person::players[closest]->skeleton.joints[i].position, 0, 0, Person::players[closest]->tilt), Person::players[closest]->tilt2, 0, 0), 0, Person::players[closest]->yaw, 0) * Person::players[closest]->scale + Person::players[closest]->coords;
+                if (Person::players[closest]->skeleton.free)
+                    flatfacing2 = Person::players[closest]->skeleton.joints[i].position * Person::players[closest]->scale + Person::players[closest]->coords;
+                flatvelocity2.x += (float)(abs(Random() % 100) - 50) / 10;
+                flatvelocity2.y += (float)(abs(Random() % 100) - 50) / 10;
+                flatvelocity2.z += (float)(abs(Random() % 100) - 50) / 10;
+                Sprite::MakeSprite(bloodflamesprite, flatfacing2, flatvelocity2, 1, 1, 1, 3, 1);
+                Sprite::MakeSprite(bloodsprite, flatfacing2, flatvelocity2, 1, 1, 1, .4, 1);
+            }
 
-                for (int i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) {
-                    if (!Person::players[closest]->skeleton.free)
-                        flatvelocity2 = Person::players[closest]->velocity;
-                    if (Person::players[closest]->skeleton.free)
-                        flatvelocity2 = Person::players[closest]->skeleton.joints[i].velocity;
-                    if (!Person::players[closest]->skeleton.free)
-                        flatfacing2 = DoRotation(DoRotation(DoRotation(Person::players[closest]->skeleton.joints[i].position, 0, 0, Person::players[closest]->tilt), Person::players[closest]->tilt2, 0, 0), 0, Person::players[closest]->yaw, 0) * Person::players[closest]->scale + Person::players[closest]->coords;
-                    if (Person::players[closest]->skeleton.free)
-                        flatfacing2 = Person::players[closest]->skeleton.joints[i].position * Person::players[closest]->scale + Person::players[closest]->coords;
-                    flatvelocity2.x += (float)(abs(Random() % 100) - 50) / 10;
-                    flatvelocity2.y += (float)(abs(Random() % 100) - 50) / 10;
-                    flatvelocity2.z += (float)(abs(Random() % 100) - 50) / 10;
-                    Sprite::MakeSprite(bloodflamesprite, flatfacing2, flatvelocity2 * 2, 1, 1, 1, 3, 1);
-                    Sprite::MakeSprite(bloodsprite, flatfacing2, flatvelocity2 * 2, 1, 1, 1, .4, 1);
-                }
+            for (int i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) {
+                if (!Person::players[closest]->skeleton.free)
+                    flatvelocity2 = Person::players[closest]->velocity;
+                if (Person::players[closest]->skeleton.free)
+                    flatvelocity2 = Person::players[closest]->skeleton.joints[i].velocity;
+                if (!Person::players[closest]->skeleton.free)
+                    flatfacing2 = DoRotation(DoRotation(DoRotation(Person::players[closest]->skeleton.joints[i].position, 0, 0, Person::players[closest]->tilt), Person::players[closest]->tilt2, 0, 0), 0, Person::players[closest]->yaw, 0) * Person::players[closest]->scale + Person::players[closest]->coords;
+                if (Person::players[closest]->skeleton.free)
+                    flatfacing2 = Person::players[closest]->skeleton.joints[i].position * Person::players[closest]->scale + Person::players[closest]->coords;
+                flatvelocity2.x += (float)(abs(Random() % 100) - 50) / 10;
+                flatvelocity2.y += (float)(abs(Random() % 100) - 50) / 10;
+                flatvelocity2.z += (float)(abs(Random() % 100) - 50) / 10;
+                Sprite::MakeSprite(bloodflamesprite, flatfacing2, flatvelocity2 * 2, 1, 1, 1, 3, 1);
+                Sprite::MakeSprite(bloodsprite, flatfacing2, flatvelocity2 * 2, 1, 1, 1, .4, 1);
+            }
 
-                for (int i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) {
-                    if (!Person::players[closest]->skeleton.free)
-                        flatvelocity2 = Person::players[closest]->velocity;
-                    if (Person::players[closest]->skeleton.free)
-                        flatvelocity2 = Person::players[closest]->skeleton.joints[i].velocity;
-                    if (!Person::players[closest]->skeleton.free)
-                        flatfacing2 = DoRotation(DoRotation(DoRotation(Person::players[closest]->skeleton.joints[i].position, 0, 0, Person::players[closest]->tilt), Person::players[closest]->tilt2, 0, 0), 0, Person::players[closest]->yaw, 0) * Person::players[closest]->scale + Person::players[closest]->coords;
-                    if (Person::players[closest]->skeleton.free)
-                        flatfacing2 = Person::players[closest]->skeleton.joints[i].position * Person::players[closest]->scale + Person::players[closest]->coords;
-                    flatvelocity2.x += (float)(abs(Random() % 100) - 50) / 10;
-                    flatvelocity2.y += (float)(abs(Random() % 100) - 50) / 10;
-                    flatvelocity2.z += (float)(abs(Random() % 100) - 50) / 10;
-                    Sprite::MakeSprite(bloodflamesprite, flatfacing2, flatvelocity2 * 2, 1, 1, 1, 3, 1);
-                    Sprite::MakeSprite(bloodsprite, flatfacing2, flatvelocity2 * 2, 1, 1, 1, .4, 1);
-                }
+            for (int i = 0; i < Person::players[closest]->skeleton.joints.size(); i++) {
+                if (!Person::players[closest]->skeleton.free)
+                    flatvelocity2 = Person::players[closest]->velocity;
+                if (Person::players[closest]->skeleton.free)
+                    flatvelocity2 = Person::players[closest]->skeleton.joints[i].velocity;
+                if (!Person::players[closest]->skeleton.free)
+                    flatfacing2 = DoRotation(DoRotation(DoRotation(Person::players[closest]->skeleton.joints[i].position, 0, 0, Person::players[closest]->tilt), Person::players[closest]->tilt2, 0, 0), 0, Person::players[closest]->yaw, 0) * Person::players[closest]->scale + Person::players[closest]->coords;
+                if (Person::players[closest]->skeleton.free)
+                    flatfacing2 = Person::players[closest]->skeleton.joints[i].position * Person::players[closest]->scale + Person::players[closest]->coords;
+                flatvelocity2.x += (float)(abs(Random() % 100) - 50) / 10;
+                flatvelocity2.y += (float)(abs(Random() % 100) - 50) / 10;
+                flatvelocity2.z += (float)(abs(Random() % 100) - 50) / 10;
+                Sprite::MakeSprite(bloodflamesprite, flatfacing2, flatvelocity2 * 2, 1, 1, 1, 3, 1);
+                Sprite::MakeSprite(bloodsprite, flatfacing2, flatvelocity2 * 2, 1, 1, 1, .4, 1);
+            }
 
-                XYZ temppos;
-                for (unsigned j = 0; j < Person::players.size(); j++) {
-                    if (int(j) != closest) {
-                        if (distsq(&Person::players[j]->coords, &Person::players[closest]->coords) < 25) {
-                            Person::players[j]->DoDamage((25 - distsq(&Person::players[j]->coords, &Person::players[closest]->coords)) * 60);
-                            if (Person::players[j]->skeleton.free == 2)
-                                Person::players[j]->skeleton.free = 1;
-                            Person::players[j]->skeleton.longdead = 0;
-                            Person::players[j]->RagDoll(0);
-                            for (int i = 0; i < Person::players[j]->skeleton.joints.size(); i++) {
-                                temppos = Person::players[j]->skeleton.joints[i].position + Person::players[j]->coords;
-                                if (distsq(&temppos, &Person::players[closest]->coords) < 25) {
-                                    flatvelocity2 = temppos - Person::players[closest]->coords;
-                                    Normalise(&flatvelocity2);
-                                    Person::players[j]->skeleton.joints[i].velocity += flatvelocity2 * ((20 - distsq(&temppos, &Person::players[closest]->coords)) * 20);
-                                }
+            XYZ temppos;
+            for (unsigned j = 0; j < Person::players.size(); j++) {
+                if (int(j) != closest) {
+                    if (distsq(&Person::players[j]->coords, &Person::players[closest]->coords) < 25) {
+                        Person::players[j]->DoDamage((25 - distsq(&Person::players[j]->coords, &Person::players[closest]->coords)) * 60);
+                        if (Person::players[j]->skeleton.free == 2)
+                            Person::players[j]->skeleton.free = 1;
+                        Person::players[j]->skeleton.longdead = 0;
+                        Person::players[j]->RagDoll(0);
+                        for (int i = 0; i < Person::players[j]->skeleton.joints.size(); i++) {
+                            temppos = Person::players[j]->skeleton.joints[i].position + Person::players[j]->coords;
+                            if (distsq(&temppos, &Person::players[closest]->coords) < 25) {
+                                flatvelocity2 = temppos - Person::players[closest]->coords;
+                                Normalise(&flatvelocity2);
+                                Person::players[j]->skeleton.joints[i].velocity += flatvelocity2 * ((20 - distsq(&temppos, &Person::players[closest]->coords)) * 20);
                             }
                         }
                     }
                 }
+            }
 
-                Person::players[closest]->DoDamage(10000);
-                Person::players[closest]->RagDoll(0);
-                Person::players[closest]->dead = 2;
-                Person::players[closest]->coords = 20;
-                Person::players[closest]->skeleton.free = 2;
+            Person::players[closest]->DoDamage(10000);
+            Person::players[closest]->RagDoll(0);
+            Person::players[closest]->dead = 2;
+            Person::players[closest]->coords = 20;
+            Person::players[closest]->skeleton.free = 2;
 
-                camerashake += .6;
+            camerashake += .6;
 
-            }
         }
+    }
 
-        if (Input::isKeyPressed(SDL_SCANCODE_F)) {
-            Person::players[0]->onfire = 1 - Person::players[0]->onfire;
-            if (Person::players[0]->onfire) {
-                Person::players[0]->CatchFire();
-            }
-            if (!Person::players[0]->onfire) {
-                emit_sound_at(fireendsound, Person::players[0]->coords);
-                pause_sound(stream_firesound);
-            }
+    if (Input::isKeyPressed(SDL_SCANCODE_F)) {
+        Person::players[0]->onfire = 1 - Person::players[0]->onfire;
+        if (Person::players[0]->onfire) {
+            Person::players[0]->CatchFire();
         }
+        if (!Person::players[0]->onfire) {
+            emit_sound_at(fireendsound, Person::players[0]->coords);
+            pause_sound(stream_firesound);
+        }
+    }
 
-        if (Input::isKeyPressed(SDL_SCANCODE_N) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
-            Person::players[0]->RagDoll(0);
+    if (Input::isKeyPressed(SDL_SCANCODE_N) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
+        Person::players[0]->RagDoll(0);
 
-            emit_sound_at(whooshsound, Person::players[0]->coords, 128.);
-        }
+        emit_sound_at(whooshsound, Person::players[0]->coords, 128.);
+    }
 
-        if (Input::isKeyPressed(SDL_SCANCODE_N) && Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
-            for (int i = 0; i < objects.numobjects; i++) {
-                if (objects.type[i] == treeleavestype) {
-                    objects.scale[i] *= .9;
-                }
+    if (Input::isKeyPressed(SDL_SCANCODE_N) && Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
+        for (int i = 0; i < objects.numobjects; i++) {
+            if (objects.type[i] == treeleavestype) {
+                objects.scale[i] *= .9;
             }
         }
+    }
 
-        if (Input::isKeyPressed(SDL_SCANCODE_M) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
-            editorenabled = !editorenabled;
-            if (editorenabled) {
-                Person::players[0]->damagetolerance = 100000;
-            } else {
-                Person::players[0]->damagetolerance = 200;
-            }
-            Person::players[0]->damage = 0; // these lines were in both if and else, but I think they would better fit in the if
-            Person::players[0]->permanentdamage = 0;
-            Person::players[0]->superpermanentdamage = 0;
-            Person::players[0]->bloodloss = 0;
-            Person::players[0]->deathbleeding = 0;
+    if (Input::isKeyPressed(SDL_SCANCODE_M) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
+        editorenabled = !editorenabled;
+        if (editorenabled) {
+            Person::players[0]->damagetolerance = 100000;
+        } else {
+            Person::players[0]->damagetolerance = 200;
         }
+        Person::players[0]->damage = 0; // these lines were in both if and else, but I think they would better fit in the if
+        Person::players[0]->permanentdamage = 0;
+        Person::players[0]->superpermanentdamage = 0;
+        Person::players[0]->bloodloss = 0;
+        Person::players[0]->deathbleeding = 0;
+    }
 
-        //skip level
-        if (whichlevel != -2 && Input::isKeyPressed(SDL_SCANCODE_K) && Input::isKeyDown(SDL_SCANCODE_LSHIFT) && !editorenabled) {
-            targetlevel++;
-            if (targetlevel > numchallengelevels - 1)
-                targetlevel = 0;
-            loading = 1;
-            leveltime = 5;
-        }
+    //skip level
+    if (whichlevel != -2 && Input::isKeyPressed(SDL_SCANCODE_K) && Input::isKeyDown(SDL_SCANCODE_LSHIFT) && !editorenabled) {
+        targetlevel++;
+        if (targetlevel > numchallengelevels - 1)
+            targetlevel = 0;
+        loading = 1;
+        leveltime = 5;
+    }
 
-        if (editorenabled) {
-            if (Input::isKeyPressed(SDL_SCANCODE_DELETE) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
-                int closest = findClosestPlayer();
-                if (closest >= 0) {
-                    Person::players.erase(Person::players.begin()+closest);
-                }
+    if (editorenabled) {
+        if (Input::isKeyPressed(SDL_SCANCODE_DELETE) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
+            int closest = findClosestPlayer();
+            if (closest >= 0) {
+                Person::players.erase(Person::players.begin()+closest);
             }
+        }
 
-            if (Input::isKeyPressed(SDL_SCANCODE_DELETE) && Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
-                int closest = findClosestObject();
-                if (closest >= 0)
-                    objects.position[closest].y -= 500;
-            }
+        if (Input::isKeyPressed(SDL_SCANCODE_DELETE) && Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
+            int closest = findClosestObject();
+            if (closest >= 0)
+                objects.position[closest].y -= 500;
+        }
 
-            if (Input::isKeyPressed(SDL_SCANCODE_M) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
-                if (objects.numobjects < max_objects - 1) {
-                    XYZ scenecoords;
-                    scenecoords.x = Person::players[0]->coords.x;
-                    scenecoords.z = Person::players[0]->coords.z;
-                    scenecoords.y = Person::players[0]->coords.y - 3;
-                    if (editortype == bushtype)
-                        scenecoords.y = Person::players[0]->coords.y - .5;
-                    if (editortype == firetype)
-                        scenecoords.y = Person::players[0]->coords.y - .5;
-                    //objects.MakeObject(abs(Random()%3),scenecoords,Random()%360);
-                    float temprotat, temprotat2;
-                    temprotat = editoryaw;
-                    temprotat2 = editorpitch;
-                    if (temprotat < 0 || editortype == bushtype)
-                        temprotat = Random() % 360;
-                    if (temprotat2 < 0)
-                        temprotat2 = Random() % 360;
-
-                    objects.MakeObject(editortype, scenecoords, (int)temprotat - ((int)temprotat) % 30, (int)temprotat2, editorsize);
-                    if (editortype == treetrunktype)
-                        objects.MakeObject(treeleavestype, scenecoords, Random() % 360 * (temprotat2 < 2) + (int)editoryaw - ((int)editoryaw) % 30, editorpitch, editorsize);
-                }
+        if (Input::isKeyPressed(SDL_SCANCODE_M) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
+            if (objects.numobjects < max_objects - 1) {
+                XYZ scenecoords;
+                scenecoords.x = Person::players[0]->coords.x;
+                scenecoords.z = Person::players[0]->coords.z;
+                scenecoords.y = Person::players[0]->coords.y - 3;
+                if (editortype == bushtype)
+                    scenecoords.y = Person::players[0]->coords.y - .5;
+                if (editortype == firetype)
+                    scenecoords.y = Person::players[0]->coords.y - .5;
+                //objects.MakeObject(abs(Random()%3),scenecoords,Random()%360);
+                float temprotat, temprotat2;
+                temprotat = editoryaw;
+                temprotat2 = editorpitch;
+                if (temprotat < 0 || editortype == bushtype)
+                    temprotat = Random() % 360;
+                if (temprotat2 < 0)
+                    temprotat2 = Random() % 360;
+
+                objects.MakeObject(editortype, scenecoords, (int)temprotat - ((int)temprotat) % 30, (int)temprotat2, editorsize);
+                if (editortype == treetrunktype)
+                    objects.MakeObject(treeleavestype, scenecoords, Random() % 360 * (temprotat2 < 2) + (int)editoryaw - ((int)editoryaw) % 30, editorpitch, editorsize);
             }
+        }
 
-            if (Input::isKeyPressed(SDL_SCANCODE_P) && Input::isKeyDown(SDL_SCANCODE_LSHIFT) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
-                Person::players.push_back(shared_ptr<Person>(new Person()));
+        if (Input::isKeyPressed(SDL_SCANCODE_P) && Input::isKeyDown(SDL_SCANCODE_LSHIFT) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
+            Person::players.push_back(shared_ptr<Person>(new Person()));
 
-                Person::players.back()->id = Person::players.size()-1;
+            Person::players.back()->id = Person::players.size()-1;
 
-                Person::players.back()->scale = Person::players[0]->scale;
-                Person::players.back()->creature = rabbittype;
-                Person::players.back()->howactive = editoractive;
+            Person::players.back()->scale = Person::players[0]->scale;
+            Person::players.back()->creature = rabbittype;
+            Person::players.back()->howactive = editoractive;
 
-                int k = abs(Random() % 2) + 1;
-                if (k == 0) {
-                    Person::players.back()->whichskin = 0;
-                } else if (k == 1) {
-                    Person::players.back()->whichskin = 1;
-                } else {
-                    Person::players.back()->whichskin = 2;
-                }
+            int k = abs(Random() % 2) + 1;
+            if (k == 0) {
+                Person::players.back()->whichskin = 0;
+            } else if (k == 1) {
+                Person::players.back()->whichskin = 1;
+            } else {
+                Person::players.back()->whichskin = 2;
+            }
 
-                Person::players.back()->skeletonLoad(true);
+            Person::players.back()->skeletonLoad(true);
 
-                Person::players.back()->skeleton.drawmodelclothes.textureptr.load("Textures/Belt.png", 1);
-                Person::players.back()->speed = 1 + (float)(Random() % 100) / 1000;
+            Person::players.back()->skeleton.drawmodelclothes.textureptr.load("Textures/Belt.png", 1);
+            Person::players.back()->speed = 1 + (float)(Random() % 100) / 1000;
 
-                Person::players.back()->targetyaw = Person::players[0]->targetyaw;
-                Person::players.back()->yaw = Person::players[0]->yaw;
+            Person::players.back()->targetyaw = Person::players[0]->targetyaw;
+            Person::players.back()->yaw = Person::players[0]->yaw;
 
-                Person::players.back()->coords = Person::players[0]->coords;
-                Person::players.back()->oldcoords = Person::players.back()->coords;
-                Person::players.back()->realoldcoords = Person::players.back()->coords;
+            Person::players.back()->coords = Person::players[0]->coords;
+            Person::players.back()->oldcoords = Person::players.back()->coords;
+            Person::players.back()->realoldcoords = Person::players.back()->coords;
 
-                if (Person::players[0]->creature == wolftype) {
-                    headprop = Person::players[0]->proportionhead.x / 1.1;
-                    bodyprop = Person::players[0]->proportionbody.x / 1.1;
-                    armprop = Person::players[0]->proportionarms.x / 1.1;
-                    legprop = Person::players[0]->proportionlegs.x / 1.1;
-                }
+            if (Person::players[0]->creature == wolftype) {
+                headprop = Person::players[0]->proportionhead.x / 1.1;
+                bodyprop = Person::players[0]->proportionbody.x / 1.1;
+                armprop = Person::players[0]->proportionarms.x / 1.1;
+                legprop = Person::players[0]->proportionlegs.x / 1.1;
+            }
 
-                if (Person::players[0]->creature == rabbittype) {
-                    headprop = Person::players[0]->proportionhead.x / 1.2;
-                    bodyprop = Person::players[0]->proportionbody.x / 1.05;
-                    armprop = Person::players[0]->proportionarms.x / 1.00;
-                    legprop = Person::players[0]->proportionlegs.x / 1.1;
-                }
+            if (Person::players[0]->creature == rabbittype) {
+                headprop = Person::players[0]->proportionhead.x / 1.2;
+                bodyprop = Person::players[0]->proportionbody.x / 1.05;
+                armprop = Person::players[0]->proportionarms.x / 1.00;
+                legprop = Person::players[0]->proportionlegs.x / 1.1;
+            }
 
-                if (Person::players.back()->creature == wolftype) {
-                    Person::players.back()->proportionhead = 1.1 * headprop;
-                    Person::players.back()->proportionbody = 1.1 * bodyprop;
-                    Person::players.back()->proportionarms = 1.1 * armprop;
-                    Person::players.back()->proportionlegs = 1.1 * legprop;
-                }
+            if (Person::players.back()->creature == wolftype) {
+                Person::players.back()->proportionhead = 1.1 * headprop;
+                Person::players.back()->proportionbody = 1.1 * bodyprop;
+                Person::players.back()->proportionarms = 1.1 * armprop;
+                Person::players.back()->proportionlegs = 1.1 * legprop;
+            }
 
-                if (Person::players.back()->creature == rabbittype) {
-                    Person::players.back()->proportionhead = 1.2 * headprop;
-                    Person::players.back()->proportionbody = 1.05 * bodyprop;
-                    Person::players.back()->proportionarms = 1.00 * armprop;
-                    Person::players.back()->proportionlegs = 1.1 * legprop;
-                    Person::players.back()->proportionlegs.y = 1.05 * legprop;
-                }
+            if (Person::players.back()->creature == rabbittype) {
+                Person::players.back()->proportionhead = 1.2 * headprop;
+                Person::players.back()->proportionbody = 1.05 * bodyprop;
+                Person::players.back()->proportionarms = 1.00 * armprop;
+                Person::players.back()->proportionlegs = 1.1 * legprop;
+                Person::players.back()->proportionlegs.y = 1.05 * legprop;
+            }
 
-                if (cellophane) {
-                    Person::players.back()->proportionhead.z = 0;
-                    Person::players.back()->proportionbody.z = 0;
-                    Person::players.back()->proportionarms.z = 0;
-                    Person::players.back()->proportionlegs.z = 0;
-                }
+            if (cellophane) {
+                Person::players.back()->proportionhead.z = 0;
+                Person::players.back()->proportionbody.z = 0;
+                Person::players.back()->proportionarms.z = 0;
+                Person::players.back()->proportionlegs.z = 0;
+            }
 
-                Person::players.back()->tempanimation = Animation("Tempanim", lowheight, neutral);
+            Person::players.back()->tempanimation = Animation("Tempanim", lowheight, neutral);
 
-                Person::players.back()->damagetolerance = 200;
+            Person::players.back()->damagetolerance = 200;
 
-                Person::players.back()->protectionhead = Person::players[0]->protectionhead;
-                Person::players.back()->protectionhigh = Person::players[0]->protectionhigh;
-                Person::players.back()->protectionlow = Person::players[0]->protectionlow;
-                Person::players.back()->armorhead = Person::players[0]->armorhead;
-                Person::players.back()->armorhigh = Person::players[0]->armorhigh;
-                Person::players.back()->armorlow = Person::players[0]->armorlow;
-                Person::players.back()->metalhead = Person::players[0]->metalhead;
-                Person::players.back()->metalhigh = Person::players[0]->metalhigh;
-                Person::players.back()->metallow = Person::players[0]->metallow;
+            Person::players.back()->protectionhead = Person::players[0]->protectionhead;
+            Person::players.back()->protectionhigh = Person::players[0]->protectionhigh;
+            Person::players.back()->protectionlow = Person::players[0]->protectionlow;
+            Person::players.back()->armorhead = Person::players[0]->armorhead;
+            Person::players.back()->armorhigh = Person::players[0]->armorhigh;
+            Person::players.back()->armorlow = Person::players[0]->armorlow;
+            Person::players.back()->metalhead = Person::players[0]->metalhead;
+            Person::players.back()->metalhigh = Person::players[0]->metalhigh;
+            Person::players.back()->metallow = Person::players[0]->metallow;
 
-                Person::players.back()->immobile = Person::players[0]->immobile;
+            Person::players.back()->immobile = Person::players[0]->immobile;
 
-                Person::players.back()->numclothes = Person::players[0]->numclothes;
-                for (int i = 0; i < Person::players.back()->numclothes; i++) {
-                    strcpy(Person::players.back()->clothes[i], Person::players[0]->clothes[i]);
-                    Person::players.back()->clothestintr[i] = Person::players[0]->clothestintr[i];
-                    Person::players.back()->clothestintg[i] = Person::players[0]->clothestintg[i];
-                    Person::players.back()->clothestintb[i] = Person::players[0]->clothestintb[i];
-                }
-                Person::players.back()->addClothes();
+            Person::players.back()->numclothes = Person::players[0]->numclothes;
+            for (int i = 0; i < Person::players.back()->numclothes; i++) {
+                strcpy(Person::players.back()->clothes[i], Person::players[0]->clothes[i]);
+                Person::players.back()->clothestintr[i] = Person::players[0]->clothestintr[i];
+                Person::players.back()->clothestintg[i] = Person::players[0]->clothestintg[i];
+                Person::players.back()->clothestintb[i] = Person::players[0]->clothestintb[i];
+            }
+            Person::players.back()->addClothes();
 
-                Person::players.back()->power = Person::players[0]->power;
-                Person::players.back()->speedmult = Person::players[0]->speedmult;
+            Person::players.back()->power = Person::players[0]->power;
+            Person::players.back()->speedmult = Person::players[0]->speedmult;
 
-                Person::players.back()->loaded = true;
-            }
+            Person::players.back()->loaded = true;
+        }
 
-            if (Input::isKeyPressed(SDL_SCANCODE_P) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
-                if (Person::players.back()->numwaypoints < 90) {
-                    Person::players.back()->waypoints[Person::players.back()->numwaypoints] = Person::players[0]->coords;
-                    Person::players.back()->waypointtype[Person::players.back()->numwaypoints] = editorpathtype;
-                    Person::players.back()->numwaypoints++;
-                }
+        if (Input::isKeyPressed(SDL_SCANCODE_P) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
+            if (Person::players.back()->numwaypoints < 90) {
+                Person::players.back()->waypoints[Person::players.back()->numwaypoints] = Person::players[0]->coords;
+                Person::players.back()->waypointtype[Person::players.back()->numwaypoints] = editorpathtype;
+                Person::players.back()->numwaypoints++;
             }
+        }
 
-            if (Input::isKeyPressed(SDL_SCANCODE_P) && Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
-                if (numpathpoints < 30) {
-                    bool connected, alreadyconnected;
-                    connected = 0;
-                    if (numpathpoints > 1)
-                        for (int i = 0; i < numpathpoints; i++) {
-                            if (distsq(&pathpoint[i], &Person::players[0]->coords) < .5 && i != pathpointselected && !connected) {
-                                alreadyconnected = 0;
-                                for (int j = 0; j < numpathpointconnect[pathpointselected]; j++) {
-                                    if (pathpointconnect[pathpointselected][j] == i)
-                                        alreadyconnected = 1;
-                                }
-                                if (!alreadyconnected) {
-                                    numpathpointconnect[pathpointselected]++;
-                                    connected = 1;
-                                    pathpointconnect[pathpointselected][numpathpointconnect[pathpointselected] - 1] = i;
-                                }
+        if (Input::isKeyPressed(SDL_SCANCODE_P) && Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
+            if (numpathpoints < 30) {
+                bool connected, alreadyconnected;
+                connected = 0;
+                if (numpathpoints > 1)
+                    for (int i = 0; i < numpathpoints; i++) {
+                        if (distsq(&pathpoint[i], &Person::players[0]->coords) < .5 && i != pathpointselected && !connected) {
+                            alreadyconnected = 0;
+                            for (int j = 0; j < numpathpointconnect[pathpointselected]; j++) {
+                                if (pathpointconnect[pathpointselected][j] == i)
+                                    alreadyconnected = 1;
+                            }
+                            if (!alreadyconnected) {
+                                numpathpointconnect[pathpointselected]++;
+                                connected = 1;
+                                pathpointconnect[pathpointselected][numpathpointconnect[pathpointselected] - 1] = i;
                             }
                         }
-                    if (!connected) {
-                        numpathpoints++;
-                        pathpoint[numpathpoints - 1] = Person::players[0]->coords;
-                        numpathpointconnect[numpathpoints - 1] = 0;
-                        if (numpathpoints > 1 && pathpointselected != -1) {
-                            numpathpointconnect[pathpointselected]++;
-                            pathpointconnect[pathpointselected][numpathpointconnect[pathpointselected] - 1] = numpathpoints - 1;
-                        }
-                        pathpointselected = numpathpoints - 1;
                     }
+                if (!connected) {
+                    numpathpoints++;
+                    pathpoint[numpathpoints - 1] = Person::players[0]->coords;
+                    numpathpointconnect[numpathpoints - 1] = 0;
+                    if (numpathpoints > 1 && pathpointselected != -1) {
+                        numpathpointconnect[pathpointselected]++;
+                        pathpointconnect[pathpointselected][numpathpointconnect[pathpointselected] - 1] = numpathpoints - 1;
+                    }
+                    pathpointselected = numpathpoints - 1;
                 }
             }
+        }
 
-            if (Input::isKeyPressed(SDL_SCANCODE_PERIOD)) {
-                pathpointselected++;
-                if (pathpointselected >= numpathpoints)
-                    pathpointselected = -1;
-            }
-            if (Input::isKeyPressed(SDL_SCANCODE_COMMA) && !Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
-                pathpointselected--;
-                if (pathpointselected <= -2)
-                    pathpointselected = numpathpoints - 1;
-            }
-            if (Input::isKeyPressed(SDL_SCANCODE_COMMA) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
-                if (pathpointselected != -1) {
-                    numpathpoints--;
-                    pathpoint[pathpointselected] = pathpoint[numpathpoints];
-                    numpathpointconnect[pathpointselected] = numpathpointconnect[numpathpoints];
-                    for (int i = 0; i < numpathpointconnect[pathpointselected]; i++) {
-                        pathpointconnect[pathpointselected][i] = pathpointconnect[numpathpoints][i];
-                    }
-                    for (int i = 0; i < numpathpoints; i++) {
-                        for (int j = 0; j < numpathpointconnect[i]; j++) {
-                            if (pathpointconnect[i][j] == pathpointselected) {
-                                pathpointconnect[i][j] = pathpointconnect[i][numpathpointconnect[i] - 1];
-                                numpathpointconnect[i]--;
-                            }
-                            if (pathpointconnect[i][j] == numpathpoints) {
-                                pathpointconnect[i][j] = pathpointselected;
-                            }
+        if (Input::isKeyPressed(SDL_SCANCODE_PERIOD)) {
+            pathpointselected++;
+            if (pathpointselected >= numpathpoints)
+                pathpointselected = -1;
+        }
+        if (Input::isKeyPressed(SDL_SCANCODE_COMMA) && !Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
+            pathpointselected--;
+            if (pathpointselected <= -2)
+                pathpointselected = numpathpoints - 1;
+        }
+        if (Input::isKeyPressed(SDL_SCANCODE_COMMA) && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
+            if (pathpointselected != -1) {
+                numpathpoints--;
+                pathpoint[pathpointselected] = pathpoint[numpathpoints];
+                numpathpointconnect[pathpointselected] = numpathpointconnect[numpathpoints];
+                for (int i = 0; i < numpathpointconnect[pathpointselected]; i++) {
+                    pathpointconnect[pathpointselected][i] = pathpointconnect[numpathpoints][i];
+                }
+                for (int i = 0; i < numpathpoints; i++) {
+                    for (int j = 0; j < numpathpointconnect[i]; j++) {
+                        if (pathpointconnect[i][j] == pathpointselected) {
+                            pathpointconnect[i][j] = pathpointconnect[i][numpathpointconnect[i] - 1];
+                            numpathpointconnect[i]--;
+                        }
+                        if (pathpointconnect[i][j] == numpathpoints) {
+                            pathpointconnect[i][j] = pathpointselected;
                         }
                     }
-                    pathpointselected = numpathpoints - 1;
                 }
+                pathpointselected = numpathpoints - 1;
             }
+        }
 
-            if (Input::isKeyPressed(SDL_SCANCODE_LEFT) && Input::isKeyDown(SDL_SCANCODE_LSHIFT) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
+        if (Input::isKeyPressed(SDL_SCANCODE_LEFT) && Input::isKeyDown(SDL_SCANCODE_LSHIFT) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
+            editortype--;
+            if (editortype == treeleavestype || editortype == 10)
                 editortype--;
-                if (editortype == treeleavestype || editortype == 10)
-                    editortype--;
-                if (editortype < 0)
-                    editortype = firetype;
-            }
+            if (editortype < 0)
+                editortype = firetype;
+        }
 
-            if (Input::isKeyPressed(SDL_SCANCODE_RIGHT) && Input::isKeyDown(SDL_SCANCODE_LSHIFT) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
+        if (Input::isKeyPressed(SDL_SCANCODE_RIGHT) && Input::isKeyDown(SDL_SCANCODE_LSHIFT) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
+            editortype++;
+            if (editortype == treeleavestype || editortype == 10)
                 editortype++;
-                if (editortype == treeleavestype || editortype == 10)
-                    editortype++;
-                if (editortype > firetype)
-                    editortype = 0;
-            }
+            if (editortype > firetype)
+                editortype = 0;
+        }
 
-            if (Input::isKeyDown(SDL_SCANCODE_LEFT) && !Input::isKeyDown(SDL_SCANCODE_LSHIFT) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
-                editoryaw -= multiplier * 100;
-                if (editoryaw < -.01)
-                    editoryaw = -.01;
-            }
+        if (Input::isKeyDown(SDL_SCANCODE_LEFT) && !Input::isKeyDown(SDL_SCANCODE_LSHIFT) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
+            editoryaw -= multiplier * 100;
+            if (editoryaw < -.01)
+                editoryaw = -.01;
+        }
 
-            if (Input::isKeyDown(SDL_SCANCODE_RIGHT) && !Input::isKeyDown(SDL_SCANCODE_LSHIFT) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
-                editoryaw += multiplier * 100;
-            }
+        if (Input::isKeyDown(SDL_SCANCODE_RIGHT) && !Input::isKeyDown(SDL_SCANCODE_LSHIFT) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
+            editoryaw += multiplier * 100;
+        }
 
-            if (Input::isKeyDown(SDL_SCANCODE_UP) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
-                editorsize += multiplier;
-            }
+        if (Input::isKeyDown(SDL_SCANCODE_UP) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
+            editorsize += multiplier;
+        }
 
-            if (Input::isKeyDown(SDL_SCANCODE_DOWN) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
-                editorsize -= multiplier;
-                if (editorsize < .1)
-                    editorsize = .1;
-            }
+        if (Input::isKeyDown(SDL_SCANCODE_DOWN) && !Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
+            editorsize -= multiplier;
+            if (editorsize < .1)
+                editorsize = .1;
+        }
 
 
-            if (Input::isKeyPressed(SDL_SCANCODE_LEFT) && Input::isKeyDown(SDL_SCANCODE_LSHIFT) && Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
-                mapradius -= multiplier * 10;
-            }
+        if (Input::isKeyPressed(SDL_SCANCODE_LEFT) && Input::isKeyDown(SDL_SCANCODE_LSHIFT) && Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
+            mapradius -= multiplier * 10;
+        }
 
-            if (Input::isKeyPressed(SDL_SCANCODE_RIGHT) && Input::isKeyDown(SDL_SCANCODE_LSHIFT) && Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
-                mapradius += multiplier * 10;
-            }
-            if (Input::isKeyDown(SDL_SCANCODE_UP) && Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
-                editorpitch += multiplier * 100;
-            }
+        if (Input::isKeyPressed(SDL_SCANCODE_RIGHT) && Input::isKeyDown(SDL_SCANCODE_LSHIFT) && Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
+            mapradius += multiplier * 10;
+        }
+        if (Input::isKeyDown(SDL_SCANCODE_UP) && Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
+            editorpitch += multiplier * 100;
+        }
 
-            if (Input::isKeyDown(SDL_SCANCODE_DOWN) && Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
-                editorpitch -= multiplier * 100;
-                if (editorpitch < -.01)
-                    editorpitch = -.01;
-            }
-            if (Input::isKeyPressed(SDL_SCANCODE_DELETE) && objects.numobjects && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
-                int closest = findClosestObject();
-                if (closest >= 0)
-                    objects.DeleteObject(closest);
-            }
+        if (Input::isKeyDown(SDL_SCANCODE_DOWN) && Input::isKeyDown(SDL_SCANCODE_LCTRL)) {
+            editorpitch -= multiplier * 100;
+            if (editorpitch < -.01)
+                editorpitch = -.01;
+        }
+        if (Input::isKeyPressed(SDL_SCANCODE_DELETE) && objects.numobjects && Input::isKeyDown(SDL_SCANCODE_LSHIFT)) {
+            int closest = findClosestObject();
+            if (closest >= 0)
+                objects.DeleteObject(closest);
         }
     }
 }
@@ -4658,8 +4659,9 @@ void updateControlsMenu()
     Menu::setText(6, (string)"Draw: "    + (keyselect == 6 ? "_" : Input::keyToChar(drawkey)));
     Menu::setText(7, (string)"Throw: "   + (keyselect == 7 ? "_" : Input::keyToChar(throwkey)));
     Menu::setText(8, (string)"Attack: "  + (keyselect == 8 ? "_" : Input::keyToChar(attackkey)));
-    if (debugmode)
+    if (debugmode) {
         Menu::setText(9, (string)"Console: " + (keyselect == 9 ? "_" : Input::keyToChar(consolekey)));
+    }
 }
 
 /*
@@ -4717,8 +4719,9 @@ void Game::LoadMenu()
         Menu::addButton(6, "", 10 + 40, 160);
         Menu::addButton(7, "", 10 + 30, 120);
         Menu::addButton(8, "", 10 + 20, 80);
-        if (debugmode)
+        if (debugmode) {
             Menu::addButton(9, "", 10 + 10, 40);
+        }
         Menu::addButton(debugmode ? 10 : 9, "Back", 10, 10);
         updateControlsMenu();
         break;
@@ -5756,12 +5759,7 @@ void Game::Tick()
                 loading = 1;
                 leveltime = 5;
             }
-            if (!Input::isKeyDown(jumpkey))
-                respawnkeydown = 0;
-            if (Input::isKeyDown(jumpkey))
-                respawnkeydown = 1;
-
-
+            respawnkeydown = Input::isKeyDown(jumpkey);
 
 
             static bool movekey;
index 42d5d352c3a83dbe1b4ae027ca4dea311a8c1926..97cdbb2d665b0f83665c3fd9158da7d950756271 100644 (file)
@@ -52,7 +52,6 @@ void DefaultSettings()
     velocityblur = 0;
     volume = 0.8f;
     ambientsound = 1;
-    debugmode = 0;
 
     crouchkey = SDL_SCANCODE_LSHIFT;
     jumpkey = SDL_SCANCODE_SPACE;
@@ -128,8 +127,6 @@ void SaveSettings()
     opstream << damageeffects;
     opstream << "\nText:\n";
     opstream << texttoggle;
-    opstream << "\nDebug:\n";
-    opstream << debugmode;
     opstream << "\nShow Points:\n";
     opstream << showpoints;
     opstream << "\nAlways Blur:\n";
@@ -244,8 +241,6 @@ bool LoadSettings()
             ipstream >> damageeffects;
         } else if ( !strncmp(setting, "Text", 4) ) {
             ipstream >> texttoggle;
-        } else if ( !strncmp(setting, "Debug", 5) ) {
-            ipstream >> debugmode;
         } else if ( !strncmp(setting, "Show Points", 11) ) {
             ipstream >> showpoints;
         } else if ( !strncmp(setting, "Always Blur", 11) ) {
index c50e893b67ef572a4457bd61fcc4dcd3d36167b6..4ff4ebc29d788e0063ef18e70bbe2b0e1b44686b 100644 (file)
@@ -581,6 +581,7 @@ const option::Descriptor usage[] =
     {SOUND,             OPENAL_OUTPUT_OSS,      "",     "force-oss",        option::Arg::None,  " --force-oss       Force use of OSS back-end." },
     {OPENALINFO,        0,                      "",     "openal-info",      option::Arg::None,  " --openal-info     Print info about OpenAL at launch." },
     {SHOWRESOLUTIONS,   0,                      "",     "showresolutions",  option::Arg::None,  " --showresolutions List the resolutions found by SDL at launch." },
+    {DEBUG,             0,                      "d",     "debug",           option::Arg::None,  " -d, --debug       Activates console, level editor and debug information." },
     {0,0,0,0,0,0}
 };
 
@@ -616,6 +617,8 @@ int main(int argc, char **argv)
         return 1;
     }
 
+    debugmode = commandLineOptions[DEBUG];
+
     // !!! FIXME: we could use a Win32 API for this.  --ryan.
 #ifndef WIN32
     chdirToAppPath(argv[0]);