* Fixed the Yeti's sprite choosing per Groundwater's request.
authorOndřej Hošek <ondra.hosek@gmail.com>
Thu, 3 Nov 2005 10:36:01 +0000 (10:36 +0000)
committerOndřej Hošek <ondra.hosek@gmail.com>
Thu, 3 Nov 2005 10:36:01 +0000 (10:36 +0000)
* Added a "flip" cheat to flip the level vertically.
* Added the --disable-sfx and --disable-music commandline args.

SVN-Revision: 2937

data/images/creatures/yeti/yeti.sprite
src/badguy/yeti.cpp
src/game_session.cpp
src/main.cpp

index 576fbd2..fe77eaf 100644 (file)
@@ -1,10 +1,10 @@
 (supertux-sprite
   (action
     (name "right")
-    (images "iceyeti_0.png"  
+    (images "iceyeti_0.png"
            "iceyeti_1.png"
            "iceyeti_2.png"
-           "iceyeti_1.png")
+           "iceyeti_1.png")
   )
   (action
     (name "left")
     (name "jump-left")
     (mirror-action "jump-right")
   )
+  (action
+    (name "stand-right")
+    (images "iceyeti_1.png")
+  )
+  (action
+    (name "stand-left")
+    (mirror-action "stand-right")
+  )
 )
-  
index 7ca7c6b..10a33e0 100644 (file)
@@ -91,6 +91,10 @@ Yeti::active_update(float elapsed_time)
         // jump
         sound_manager->play("sounds/yeti_gna.wav");
         physic.set_velocity_y(JUMP_VEL1);
+        if (side == LEFT)  // on the left, facing Tux who is on the right
+          sprite->set_action("jump-right");
+        else
+          sprite->set_action("jump-left");
       }
       break;
     default:
@@ -104,6 +108,7 @@ void
 Yeti::go_right()
 {
   // jump and move right
+  sprite->set_action("right");
   physic.set_velocity_y(JUMP_VEL1);
   physic.set_velocity_x(RUN_SPEED);
   state = GO_RIGHT;
@@ -113,6 +118,7 @@ Yeti::go_right()
 void
 Yeti::go_left()
 {
+  sprite->set_action("left");
   physic.set_velocity_y(JUMP_VEL1);
   physic.set_velocity_x(-RUN_SPEED);
   state = GO_LEFT;
@@ -214,18 +220,20 @@ Yeti::collision_solid(GameObject& , const CollisionHit& hit)
     } else if(state == GO_LEFT && !timer.started()) {
       side = LEFT;
       summon_snowball();
-      sprite->set_action("right");
+      sprite->set_action("stand-right");
       angry_jumping();
     } else if(state == GO_RIGHT && !timer.started()) {
       side = RIGHT;
       summon_snowball();
-      sprite->set_action("left");
+      sprite->set_action("stand-left");
       angry_jumping();
     } else if(state == ANGRY_JUMPING) {
       if(!timer.started()) {
         // we just landed
-       // FixME need help here setting the walk,stand,jump image states
-       sprite->set_action("jump-right");
+        if (side == LEFT)  // standing on the left, facing Tux who is on the right
+             sprite->set_action("stand-right");
+           else
+             sprite->set_action("stand-left");
         jumpcount++;
         // make a stalactite falling down and shake camera a bit
         Sector::current()->camera->shake(.1, 0, 10);
index 65ce7c4..5bca083 100644 (file)
@@ -64,6 +64,7 @@
 #include "gameconfig.hpp"
 #include "gettext.hpp"
 #include "exceptions.hpp"
+#include "flip_level_transformer.hpp"
 
 // the engine will be run with a logical framerate of 64fps.
 // We chose 64fps here because it is a power of 2, so 1/64 gives an "even"
@@ -368,6 +369,10 @@ GameSession::try_cheats()
     currentsector->camera->reset(
         Vector(tux.get_pos().x, tux.get_pos().y));
   }
+  if(main_controller->check_cheatcode("flip")) {
+       FlipLevelTransformer flip_transformer;
+    flip_transformer.transform(GameSession::current()->get_current_level());
+  }
   if(main_controller->check_cheatcode("finish")) {
     // finish current sector
     exit_status = ES_LEVEL_FINISHED;
index f89805d..22073bb 100644 (file)
@@ -187,6 +187,8 @@ static void print_usage(const char* argv0)
             "  -f, --fullscreen             Run in fullscreen mode\n"
             "  -w, --window                 Run in window mode\n"
             "  -g, --geometry WIDTHxHEIGHT  Run SuperTux in given resolution\n"
+            "  --disable-sfx                Disable sound effects\n"
+            "  --disable-music              Disable music\n"
             "  --help                       Show this help message\n"
             "  --version                    Display SuperTux version and quit\n"
             "  --show-fps                   Display framerate in levels\n"
@@ -216,6 +218,10 @@ static void parse_commandline(int argc, char** argv)
       }
     } else if(arg == "--show-fps") {
       config->show_fps = true;
+    } else if(arg == "--disable-sfx") {
+      config->sound_enabled = false;
+    } else if(arg == "--disable-music") {
+      config->music_enabled = false;
     } else if(arg == "--play-demo") {
       if(i+1 >= argc) {
         print_usage(argv[0]);