[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs exit.cxx,NONE,1.1 exit.hxx,
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs exit.cxx,NONE,1.1 exit.hxx,NONE,1.1 Makefile.am,1.16,1.17 |
Date: |
27 Sep 2002 16:01:57 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/worldobjs
In directory dark:/tmp/cvs-serv2691/worldobjs
Modified Files:
Makefile.am
Added Files:
exit.cxx exit.hxx
Log Message:
splitted Exit
--- NEW FILE: exit.cxx ---
// $Id: exit.cxx,v 1.1 2002/09/27 16:01:55 torangan Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
// 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 "../graphic_context.hxx"
#include "../col_map.hxx"
#include "../world.hxx"
#include "../globals.hxx"
#include "../pingu_holder.hxx"
#include "../string_converter.hxx"
#include "../pingu_action.hxx"
#include "../pingu.hxx"
#include "../worldobjsdata/exit_data.hxx"
#include "exit.hxx"
namespace WorldObjs {
Exit::Exit (const WorldObjsData::ExitData& data_)
: data(new WorldObjsData::ExitData(data_)),
sprite(data->desc, 10.0f),
flag("misc/flag" + to_string(data->owner_id), "core")
{
flag.set_align_center_bottom();
if (verbose > 2)
std::cout << "Creating Exit" << std::endl;
sprite.set_align_center_bottom();
if (data->use_old_pos_handling) {
data->pos.x += sprite.get_width() / 2;
data->pos.y += sprite.get_height();
data->use_old_pos_handling = false;
}
}
Exit::~Exit ()
{
delete data;
}
void
Exit::on_startup ()
{
world->get_colmap()->remove(sprite.get_surface(),
static_cast<int>(data->pos.x) -
sprite.get_width()/2,
static_cast<int>(data->pos.y) -
sprite.get_height());
}
void
Exit::draw (GraphicContext& gc)
{
gc.draw(sprite, data->pos);
gc.draw(flag, data->pos + CL_Vector(40, 0));
}
void
Exit::update (float delta)
{
sprite.update(delta);
PinguHolder* holder = world->get_pingu_p();
for (PinguIter pingu = holder->begin(); pingu != holder->end(); ++pingu)
{
if ( (*pingu)->get_x() > data->pos.x - 1 && (*pingu)->get_x() <
data->pos.x + 1
&& (*pingu)->get_y() > data->pos.y - 5 && (*pingu)->get_y() <
data->pos.y + 1)
{
if ( (*pingu)->get_status() != PS_EXITED
&& (*pingu)->get_status() != PS_DEAD
&& (*pingu)->get_action()->get_type() != Actions::Exiter)
{
(*pingu)->set_action(Actions::Exiter);
}
}
}
}
float
Exit::get_z_pos () const
{
return data->pos.z;
}
} // namespace WorldObjs
/* EOF */
--- NEW FILE: exit.hxx ---
// $Id: exit.hxx,v 1.1 2002/09/27 16:01:55 torangan Exp $
//
// Pingus - A free Lemmings clone
// Copyright (C) 1999 Ingo Ruhnke <address@hidden>
//
// 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 HEADER_PINGUS_WORLDOBJS_EXIT_HXX
#define HEADER_PINGUS_WORLDOBJS_EXIT_HXX
#include "../worldobj.hxx"
#include "../sprite.hxx"
namespace WorldObjsData {
class ExitData;
}
namespace WorldObjs {
class Exit : public WorldObj
{
private:
WorldObjsData::ExitData* const data;
Sprite sprite;
Sprite flag;
public:
Exit (const WorldObjsData::ExitData& data_);
~Exit ();
void on_startup ();
void draw (GraphicContext& gc);
void update (float delta);
float get_z_pos () const;
private:
Exit (const Exit&);
Exit& operator= (const Exit&);
};
} // namespace WorldObjs
#endif
/* EOF */
Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/Makefile.am,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- Makefile.am 27 Sep 2002 11:26:49 -0000 1.16
+++ Makefile.am 27 Sep 2002 16:01:55 -0000 1.17
@@ -25,6 +25,7 @@
bumper.cxx bumper.hxx \
conveyor_belt.cxx conveyor_belt.hxx \
entrance.cxx entrance.hxx \
+ exit.cxx exit.hxx \
fake_exit.cxx fake_exit.hxx \
guillotine.cxx guillotine.hxx \
groundpiece.hxx groundpiece.cxx \
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/worldobjs exit.cxx,NONE,1.1 exit.hxx,NONE,1.1 Makefile.am,1.16,1.17,
torangan <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/editorobjs exit_obj.cxx,NONE,1.1 exit_obj.hxx,NONE,1.1 Makefile.am,1.12,1.13
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata exit_data.cxx,NONE,1.1 exit_data.hxx,NONE,1.1 Makefile.am,1.15,1.16
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/editorobjs exit_obj.cxx,NONE,1.1 exit_obj.hxx,NONE,1.1 Makefile.am,1.12,1.13
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src/worldobjsdata exit_data.cxx,NONE,1.1 exit_data.hxx,NONE,1.1 Makefile.am,1.15,1.16
- Index(es):