From 7fb55b8cecaf67cbfa975bedabac4c76d18b990f Mon Sep 17 00:00:00 2001 From: Ricardo Cruz Date: Tue, 19 Oct 2004 16:27:50 +0000 Subject: [PATCH] Bugfix: enemies ordinary pictures were not being displayed in the leveleditor's selection bar. Bugfix: removed Bomb badguy from selection bar. Also, changed in badguy's when activate() happens: <= 0... SVN-Revision: 2033 --- src/badguy.cpp | 19 +++++++++++++++++-- src/leveleditor.cpp | 12 ++++++++---- 2 files changed, 25 insertions(+), 6 deletions(-) diff --git a/src/badguy.cpp b/src/badguy.cpp index da1c49e3e..70ac1a73e 100644 --- a/src/badguy.cpp +++ b/src/badguy.cpp @@ -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); } diff --git a/src/leveleditor.cpp b/src/leveleditor.cpp index 623a51355..4e231300c 100644 --- a/src/leveleditor.cpp +++ b/src/leveleditor.cpp @@ -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 (*i); - if(badguy) - badguy->activate(LEFT); +// if(badguy) +// badguy->activate(LEFT); TileMap* tilemap = dynamic_cast (*i); if(tilemap) -- 2.11.0