pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] CVS: Games/Pingus/src/worldobjs groundpiece.cxx,NONE,1.1 gr


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src/worldobjs groundpiece.cxx,NONE,1.1 groundpiece.hxx,NONE,1.1 Makefile.am,1.10,1.11
Date: 16 Sep 2002 19:18:58 -0000

Update of /usr/local/cvsroot/Games/Pingus/src/worldobjs
In directory dark:/tmp/cvs-serv6593/worldobjs

Modified Files:
        Makefile.am 
Added Files:
        groundpiece.cxx groundpiece.hxx 
Log Message:
introducing WorldObj Groundpieces...

--- NEW FILE: groundpiece.cxx ---
//  $Id: groundpiece.cxx,v 1.1 2002/09/16 19:18:56 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 2002 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 "../world.hxx"
#include "../pingu_map.hxx"
#include "../col_map.hxx"
#include "../pingus_resource.hxx"
#include "groundpiece.hxx"

namespace WorldObjs {

Groundpiece::Groundpiece(const GroundpieceData& data_)
  : data(data_),
    surface (PingusResource::load_surface(data.desc))
{
  // FIXME: we don't need to load surfaces here, providers would be
  // FIXME: enough and should be faster
}

void
Groundpiece::on_startup()
{
  // FIXME: overdrawing of bridges and similar things aren't handled
  // FIXME: here
  if (data.gptype == GroundpieceData::GP_REMOVE)
    get_world()->get_gfx_map()->remove(surface, int(data.pos.x), 
int(data.pos.y));
  else
    get_world()->get_gfx_map()->put(surface, int(data.pos.x), int(data.pos.y));

  if (data.gptype == GroundpieceData::GP_REMOVE)
    get_world()->get_colmap()->remove(surface, int(data.pos.x), 
int(data.pos.y));
  else
    get_world()->get_colmap()->put(surface, int(data.pos.x), int(data.pos.y),
                                   data.gptype);
}

} // namespace WorldObjs

/* EOF */

--- NEW FILE: groundpiece.hxx ---
//  $Id: groundpiece.hxx,v 1.1 2002/09/16 19:18:56 grumbel Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2002 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_GROUNDPIECE_HXX
#define HEADER_GROUNDPIECE_HXX

#include "../worldobj.hxx"
#include "../groundpiece_data.hxx"

namespace WorldObjs {

/** Groundpieces form the ground on which the pingus can walk, which
    they can dig and which they can detonate away */
class Groundpiece : public WorldObj
{
private:
  GroundpieceData data;
  CL_Surface surface;

public:
  Groundpiece(const GroundpieceData& data_);
  ~Groundpiece() {};

  float get_z_pos () const { return 0; }

  void draw(GraphicContext& gc) {}
  void on_startup();
  bool purge_after_startup() { return true; }
private:
  Groundpiece (const Groundpiece&);
  Groundpiece operator= (const Groundpiece&);
};

} // namespace WorldObjs

#endif

/* EOF */

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/Makefile.am,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- Makefile.am 16 Sep 2002 16:04:58 -0000      1.10
+++ Makefile.am 16 Sep 2002 19:18:56 -0000      1.11
@@ -24,6 +24,7 @@
         conveyor_belt.cxx          conveyor_belt.hxx \
        fake_exit.cxx              fake_exit.hxx     \
        guillotine.cxx             guillotine.hxx    \
+        groundpiece.hxx            groundpiece.cxx   \
        hammer.cxx                 hammer.hxx        \
         ice_block.cxx              ice_block.hxx     \
         info_box.cxx               info_box.hxx      \





reply via email to

[Prev in Thread] Current Thread [Next in Thread]