Bugfix: enemies ordinary pictures were not being displayed in the leveleditor's selec...
authorRicardo Cruz <rick2@aeiou.pt>
Tue, 19 Oct 2004 16:27:50 +0000 (16:27 +0000)
committerRicardo Cruz <rick2@aeiou.pt>
Tue, 19 Oct 2004 16:27:50 +0000 (16:27 +0000)
Bugfix: removed Bomb badguy from selection bar.
Also, changed in badguy's when activate() happens: <= 0...

SVN-Revision: 2033

src/badguy.cpp
src/leveleditor.cpp

index da1c49e..70ac1a7 100644 (file)
@@ -199,8 +199,8 @@ BadGuy::init()
       activate(LEFT);
     }
   } } else {
-    if(start_position.x > 0 && start_position.x <= screen->w
-        && start_position.y > 0 && start_position.y <= screen->h)
+    if(start_position.x >= 0 && start_position.x < screen->w
+        && start_position.y >= 0 && start_position.y < screen->h)
       activate(LEFT);
   }
 }
@@ -284,6 +284,21 @@ BadGuy::activate(Direction activation_dir)
 Surface*
 BadGuy::get_image()
 {
+// Set action as the "default" one.
+specs->sprite->set_action("left");
+if(BAD_JUMPY)
+  specs->sprite->set_action("left-up");
+else if(kind == BAD_BOMB)
+  specs->sprite->set_action("ticking-left");
+else if(kind == BAD_FLAME)
+  specs->sprite->set_action("normal");
+else if(kind == BAD_STALACTITE)
+  specs->sprite->set_action("normal");
+else if(kind == BAD_FISH)
+  specs->sprite->set_action("normal");
+else if(kind == BAD_FLAMEFISH)
+  specs->sprite->set_action("normal");
+
 return specs->sprite->get_frame(0);
 }
 
index 623a513..4e23130 100644 (file)
@@ -126,9 +126,13 @@ for(unsigned int id = 1; id < tilemanager->total_ids(); id++)
   }
 for(int i = 0; i < NUM_BadGuyKinds; i++)
   {
+  // filter bomb, since it is only for internal use, not for levels
+  if(i == BAD_BOMB)
+    continue;
+
   BadGuyKind kind = BadGuyKind(i);
   BadGuy badguy(kind, 0,0);
-  badguy.activate(LEFT);
+//  badguy.activate(LEFT);
 
   Surface *img = badguy.get_image();
   tiles_board->add_button(Button(img, "", SDLKey(SDLK_1+i)), -(i+1));
@@ -619,7 +623,7 @@ if(sector)
           {
           BadGuyKind kind = BadGuyKind((-id)-1);
           BadGuy badguy(kind, 0,0);
-          badguy.activate(LEFT);
+//          badguy.activate(LEFT);
           Surface *img = badguy.get_image();
 
           context.draw_surface(img, Vector(event.button.x - 8,
@@ -782,8 +786,8 @@ foregrounds = solids = backgrounds = 0;
 for(Sector::GameObjects::iterator i = sector->gameobjects.begin(); i != sector->gameobjects.end(); i++)
   {
   BadGuy* badguy = dynamic_cast<BadGuy*> (*i);
-  if(badguy)
-    badguy->activate(LEFT);
+//  if(badguy)
+//    badguy->activate(LEFT);
 
   TileMap* tilemap = dynamic_cast<TileMap*> (*i);
   if(tilemap)