diff -urN pingus/data/pingus.scr pingusfix/data/pingus.scr --- pingus/data/pingus.scr Sun May 16 18:39:28 1999 +++ pingusfix/data/pingus.scr Sun May 16 21:28:11 1999 @@ -57,7 +57,8 @@ bmplevel = images/bmplevel.pcx (type=surface, x=0, y=0, width=800, height=480, tcol=0); entrance = images/entrance.pcx (type=surface, x=0, y=0, width=64, height=32, tcol=0); exit = images/exit.pcx (type=surface, x=0, y=0, width=64, height=64, tcol=0); - cap = images/cap.pcx (type=surface, x=0, y=0, width=34, height=34, tcol=0); + capgood = images/cap.pcx (type=surface, x=0, y=0, width=34, height=34, tcol=0); + capbad = images/capwrong.pcx (type=surface, x=0, y=0, width=34, height=34, tcol=0); clouds = images/clouds.pcx (type=surface, x=0, y=0, width=256, height=480); rock = images/rocktile.pcx (type=surface, x=0, y=0, width=32, height=32, tcol=2, array=8x8); pause = images/pause.pcx (type=surface, x=0, y=0, width=146, height=45, array=2x1); diff -urN pingus/src/CaptureRectangle.cc pingusfix/src/CaptureRectangle.cc --- pingus/src/CaptureRectangle.cc Thu Jan 1 01:00:00 1970 +++ pingusfix/src/CaptureRectangle.cc Sun May 16 22:32:46 1999 @@ -0,0 +1,73 @@ +// Pingus - A free Lemmings clone +// Copyright (C) 1999 Ingo Ruhnke + +// This program 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, +// 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. + +// 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. + +#include +#include +#include + +#include "globals.hh" +#include "pingu.hh" +#include "pingu.hh" +#include "CaptureRectangle.hh" + +CL_Surface* CaptureRectangle::good; +CL_Surface* CaptureRectangle::bad; + + +CaptureRectangle::CaptureRectangle() +{ +} + +CaptureRectangle::CaptureRectangle(Range x, Range y) +{ +x_offset = x; +y_offset = y; +} + +CaptureRectangle::~CaptureRectangle() +{ +} + +void +CaptureRectangle::draw() +{ + if (buttons->get_action()->get_environment() & current_pingu->get_environment()) + good->put_screen(current_pingu->get_x()-17+x_offset, current_pingu->get_y()-33+y_offset); + else + bad->put_screen(current_pingu->get_x()-17+x_offset, current_pingu->get_y()-33+y_offset); +} + +void +CaptureRectangle::set_buttons(ButtonPanel* b) +{ + buttons = b; +} + +void +CaptureRectangle::set_pingu(Pingu* pingu) +{ + current_pingu = pingu; +} + +void +CaptureRectangle::load_data() +{ + good = CL_Res_Surface::load("Game/capgood", *resource()); + bad = CL_Res_Surface::load("Game/capbad", *resource()); +} +/* EOF */ + diff -urN pingus/src/CaptureRectangle.hh pingusfix/src/CaptureRectangle.hh --- pingus/src/CaptureRectangle.hh Thu Jan 1 01:00:00 1970 +++ pingusfix/src/CaptureRectangle.hh Sun May 16 22:36:57 1999 @@ -0,0 +1,49 @@ +// Pingus - A free Lemmings clone +// Copyright (C) 1999 Ingo Ruhnke + +// This program 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, +// 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. + +// 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. + +#ifndef CAPTURERECTANGLE_HH +#define CAPTURERECTANGLE_HH + +#include + +#include "range.hh" +#include "world.hh" +#include "GameObj.hh" +#include "button_panel.hh" +class CaptureRectangle: public GameObj +{ +private: + Range x_offset, y_offset; + Pingu* current_pingu; + static CL_Surface* good; + static CL_Surface* bad; + ButtonPanel* buttons; +public: + World world; + CaptureRectangle(); + CaptureRectangle(Range x, Range y); + ~CaptureRectangle(); + + static void load_data(); + void set_pingu(Pingu* pingu); + void set_buttons(ButtonPanel* b); + void draw(); +}; + +#endif + +/* EOF */ diff -urN pingus/src/Makefile.am pingusfix/src/Makefile.am --- pingus/src/Makefile.am Sun May 16 18:39:30 1999 +++ pingusfix/src/Makefile.am Sun May 16 20:22:07 1999 @@ -62,5 +62,6 @@ GameObj.cc GameObj.hh \ GameTime.cc GameTime.hh \ Particle.cc Particle.hh \ - ParticleHolder.cc ParticleHolder.hh + ParticleHolder.cc ParticleHolder.hh \ + CaptureRectangle.cc CaptureRectangle.hh diff -urN pingus/src/pingu.cc pingusfix/src/pingu.cc --- pingus/src/pingu.cc Sun May 16 18:39:32 1999 +++ pingusfix/src/pingu.cc Sun May 16 22:35:04 1999 @@ -62,6 +62,13 @@ return data.y_pos; } +//Returns environment +PinguEnvironment +Pingu::get_environment() +{ + return data.environment; +} + // Set the position of the pingu void Pingu::set_pos(int x, int y) diff -urN pingus/src/pingu.hh pingusfix/src/pingu.hh --- pingus/src/pingu.hh Sun May 16 00:49:10 1999 +++ pingusfix/src/pingu.hh Sun May 16 22:34:00 1999 @@ -46,6 +46,7 @@ int get_x(); int get_y(); + PinguEnvironment get_environment(); bool is_alive(void); PinguStatus get_status(void); diff -urN pingus/src/pingus.cc pingusfix/src/pingus.cc --- pingus/src/pingus.cc Sun May 16 18:39:32 1999 +++ pingusfix/src/pingus.cc Sun May 16 21:24:20 1999 @@ -257,6 +257,7 @@ Entrance::load_data(); Trap::load_data(); Exit::load_data(); + CaptureRectangle::load_data(); if (verbose) cout << "Loading data successfull" << endl; diff -urN pingus/src/playfield.cc pingusfix/src/playfield.cc --- pingus/src/playfield.cc Sun May 16 00:49:13 1999 +++ pingusfix/src/playfield.cc Sun May 16 22:24:21 1999 @@ -27,8 +27,9 @@ #include "result.hh" #include "levelinterrupt.hh" #include "GameTime.hh" +#include "CaptureRectangle.hh" + -CL_Surface* Playfield::cap; CL_Surface* Playfield::pause_s; AnimCounter Playfield::pause_c; @@ -56,6 +57,7 @@ x_offset2 = x_offset; y_offset2 = y_offset; + cap = new CaptureRectangle(x_offset, y_offset); } Playfield::~Playfield() @@ -83,21 +86,31 @@ world.draw_offset(x_offset, y_offset); } // draw the capture rectange + current_pingu = current_pingu_find(); + if (current_pingu >-1 ) + { + cap->set_pingu((*pingu)[current_pingu] ); + cap->draw(); + } + + if (pause) { + pause_s->put_screen(0, 0, ++pause_c); + } +} + +int +Playfield::current_pingu_find() +{ for (int i=0; i < pingu->size(); ++i) { if ((*pingu)[i]->is_over(CL_Mouse::get_x()-+x_offset, CL_Mouse::get_y()-y_offset)) { - cap->put_screen((*pingu)[i]->get_x()-17+x_offset, (*pingu)[i]->get_y()-33+y_offset); - current_pingu = i; - break; - } else { - current_pingu = -1; + // cap->put_screen((*pingu)[i]->get_x()-17+x_offset, (*pingu)[i]->get_y()-33+y_offset); + return i; } } - - if (pause) { - pause_s->put_screen(0, 0, ++pause_c); - } + return -1 ; } + void Playfield::process_input() { @@ -191,7 +204,6 @@ void Playfield::load_data() { - cap = CL_Res_Surface::load("Game/cap", *resource()); pause_s = CL_Res_Surface::load("Game/pause", *resource()); pause_c.set_size(2); pause_c.set_speed(500); @@ -201,6 +213,7 @@ Playfield::set_buttons(ButtonPanel* b) { buttons = b; + cap->set_buttons(b); } void diff -urN pingus/src/playfield.hh pingusfix/src/playfield.hh --- pingus/src/playfield.hh Sun May 16 00:49:13 1999 +++ pingusfix/src/playfield.hh Sun May 16 20:54:49 1999 @@ -25,7 +25,7 @@ #include "gui_obj.hh" #include "world.hh" #include "GameObj.hh" - +#include "CaptureRectangle.hh" class Playfield : public GuiObj, public GameObj { private: @@ -36,7 +36,8 @@ CL_Surface* buffer; static CL_Surface* pause_s; static AnimCounter pause_c; - static CL_Surface* cap; + // static CL_Surface* cap; + CaptureRectangle* cap; CL_InputSourceProvider* datafile; vector* pingu; ButtonPanel* buttons; @@ -54,6 +55,7 @@ void write_results(); void process_input(); static void load_data(); + int current_pingu_find(); }; #endif