pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src/editorobjs conveyor_belt_obj.cxx,NONE


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/editorobjs conveyor_belt_obj.cxx,NONE,1.1 conveyor_belt_obj.hxx,NONE,1.1 ice_block_obj.cxx,NONE,1.1 ice_block_obj.hxx,NONE,1.1 Makefile.am,1.4,1.5 info_box_obj.cxx,1.1,1.2 info_box_obj.hxx,1.1,1.2 switch_door_obj.cxx,1.1,1.2 switch_door_obj.hxx,1.1,1.2 switch_door_switch_obj.hxx,1.1,1.2 teleporter_obj.cxx,1.4,1.5 teleporter_obj.hxx,1.4,1.5
Date: 14 Sep 2002 19:06:36 -0000

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

Modified Files:
        Makefile.am info_box_obj.cxx info_box_obj.hxx 
        switch_door_obj.cxx switch_door_obj.hxx 
        switch_door_switch_obj.hxx teleporter_obj.cxx 
        teleporter_obj.hxx 
Added Files:
        conveyor_belt_obj.cxx conveyor_belt_obj.hxx ice_block_obj.cxx 
        ice_block_obj.hxx 
Log Message:
- splitted IceBlock / ConveyorBelt
- removed unrequired includes (ignoring system headers)


--- NEW FILE: conveyor_belt_obj.cxx ---
//  $Id: conveyor_belt_obj.cxx,v 1.1 2002/09/14 19:06:34 torangan Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 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 "../editor/editor_view.hxx"
#include "../worldobjsdata/conveyor_belt_data.hxx"
#include "conveyor_belt_obj.hxx"

namespace EditorObjs {

ConveyorBeltObj::ConveyorBeltObj (WorldObjsData::ConveyorBeltData* data_)
  : data(new WorldObjsData::ConveyorBeltData(*data_))
{
}

EditorObj*
ConveyorBeltObj::duplicate()
{
  return new ConveyorBeltObj(data);
}

void
ConveyorBeltObj::draw (EditorNS::EditorView * view)
{
  view->draw(data->left_sur, data->pos, static_cast<int>(data->counter));
  for (int i=0; i < data->width; ++i)
    {
      view->draw(data->middle_sur,
                 static_cast<int>(data->pos.x) + data->left_sur.get_width() + i 
* data->middle_sur.get_width(),
                 static_cast<int>(data->pos.y),
                 static_cast<int>(data->counter));
    }
    
  view->draw(data->right_sur,
             static_cast<int>(data->pos.x) + data->left_sur.get_width() + 
data->width * data->middle_sur.get_width(),
             static_cast<int>(data->pos.y),
             static_cast<int>(data->counter));
             
  data->counter += data->speed;
  if (data->counter > 14)
    data->counter = 0;
  else if (data->counter < 0)
    data->counter = data->middle_sur.get_num_frames() - 1;

}

void
ConveyorBeltObj::draw_scroll_map (int x_pos, int y_pos, int arg_width, int 
arg_height)
{
  // not supported
  UNUSED_ARG(x_pos);
  UNUSED_ARG(y_pos);
  UNUSED_ARG(arg_width);
  UNUSED_ARG(arg_height);
}

EditorObjLst
ConveyorBeltObj::create (const CL_Vector& pos)
{
  WorldObjsData::ConveyorBeltData newdata;
  newdata.pos = pos;
  return newdata.create_EditorObj();
}
  
std::string 
ConveyorBeltObj::status_line ()
{
  char str[256];
  snprintf (str, 256, "ConveyorBelt - (%f, %f, %f) Speed: %f", data->pos.x, 
data->pos.y, data->pos.z, data->speed);
  return str;
}

int 
ConveyorBeltObj::get_width ()
{
  return   data->left_sur  .get_width()
         + data->right_sur .get_width()
         + data->middle_sur.get_width() * data->width;
}

int 
ConveyorBeltObj::get_height ()
{
  return data->middle_sur.get_height();
}

float
ConveyorBeltObj::get_z_pos () {
  return data->pos.z;
}

void 
ConveyorBeltObj::set_position_offset (const CL_Vector& offset)
{
  data->pos += offset;
}

CL_Vector
ConveyorBeltObj::get_upper_left_corner () {
  return data->pos;
}

void
ConveyorBeltObj::write_xml (std::ostream& xml)
{
  data->write_xml(xml);
}

void
ConveyorBeltObj::make_larger ()
{
  ++data->width;
}

void
ConveyorBeltObj::make_smaller ()
{
  if (data->width)
    --data->width;
}

} // namespace EditorObjs

/* EOF */

--- NEW FILE: conveyor_belt_obj.hxx ---
//  $Id: conveyor_belt_obj.hxx,v 1.1 2002/09/14 19:06:34 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 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_EDITOROBJS_CONVEYOR_BELT_OBJ_HXX
#define HEADER_PINGUS_EDITOROBJS_CONVEYOR_BELT_OBJ_HXX

#include "../editor/rect_editorobj.hxx"

class WorldObjData;

namespace WorldObjsData {
class ConveyorBeltData;
}

namespace EditorObjs {

class ConveyorBeltObj : public RectEditorObj
{
private:
  WorldObjsData::ConveyorBeltData* const data;

public:
  ConveyorBeltObj (WorldObjsData::ConveyorBeltData* data_);

  EditorObj* duplicate ();
  
  void draw (EditorNS::EditorView * view);
  void draw_scroll_map (int x_pos, int y_pos, int arg_width, int arg_height);

  int get_width ();
  int get_height ();

  float get_z_pos ();

  void set_position_offset (const CL_Vector &);
  
  static EditorObjLst create (WorldObjData* obj);

  /** Create the object with reasonable defaults */
  static EditorObjLst create (const CL_Vector& pos);

  CL_Vector get_upper_left_corner ();

  void write_xml (std::ostream& xml);
  std::string status_line ();

  void make_larger ();
  void make_smaller ();
  
private:
  ConveyorBeltObj (const ConveyorBeltObj&);
  ConveyorBeltObj operator= (const ConveyorBeltObj&);
};

} // namespace EditorObjs

#endif

/* EOF */

--- NEW FILE: ice_block_obj.cxx ---
//  $Id: ice_block_obj.cxx,v 1.1 2002/09/14 19:06:34 torangan Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 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 "../worldobjsdata/ice_block_data.hxx"
#include "ice_block_obj.hxx"

namespace EditorObjs {

IceBlockObj::IceBlockObj (WorldObjsData::IceBlockData* data_)
  : SpriteEditorObj ("iceblock", "worldobjs", &data->pos),
    data(new WorldObjsData::IceBlockData(*data_))
{
}

IceBlockObj::~IceBlockObj ()
{
  delete data;
}

/** Create the object with resonable defaults */
EditorObjLst
IceBlockObj::create (const CL_Vector& pos)
{
  WorldObjsData::IceBlockData newdata;
  newdata.pos = pos;
  return newdata.create_EditorObj();
}

std::string 
IceBlockObj::status_line ()
{
  char str[256];
  snprintf (str, 256, "IceBlock - %f %f %f", data->pos.x, data->pos.y, 
data->pos.z);
  return str;
}

void
IceBlockObj::write_xml (std::ostream& xml)
{
  data->write_xml(xml);
}

EditorObj*
IceBlockObj::duplicate ()
{
  return new IceBlockObj(data);
}

} // namespace EditorObjs

/* EOF */

--- NEW FILE: ice_block_obj.hxx ---
//  $Id: ice_block_obj.hxx,v 1.1 2002/09/14 19:06:34 torangan Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 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_EDITOROBJS_ICE_BLOCK_OBJ_HXX
#define HEADER_PINGUS_EDITOROBJS_ICE_BLOCK_OBJ_HXX

#include "../editor/sprite_editorobj.hxx"

namespace WorldObjsData {
class IceBlockData;
}

namespace EditorObjs {

class IceBlockObj : public SpriteEditorObj                        
{
private:
  WorldObjsData::IceBlockData* const data;
  
public:
  IceBlockObj (WorldObjsData::IceBlockData* data_);
 ~IceBlockObj ();

  /** Create the object with resonable defaults */
  static EditorObjLst create (const CL_Vector& pos);

  void write_xml (std::ostream& xml);
  
  EditorObj* duplicate ();
  std::string status_line ();
  
private:
  IceBlockObj (const IceBlockObj&);
  IceBlockObj operator= (const IceBlockObj&);
};

} // namespace EditorObjs

#endif

/* EOF */

Index: Makefile.am
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editorobjs/Makefile.am,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- Makefile.am 14 Sep 2002 13:35:38 -0000      1.4
+++ Makefile.am 14 Sep 2002 19:06:34 -0000      1.5
@@ -19,9 +19,11 @@
 
 libpingus_editorobjs_a_SOURCES = \
        bumper_obj.cxx             bumper_obj.hxx \
+       conveyor_belt_obj.cxx      conveyer_belt_obj.hxx \
        fake_exit_obj.cxx          fake_exit_obj.hxx \
        guillotine_obj.cxx         guillotine_obj.hxx \
        hammer_obj.cxx             hammer_obj.hxx \
+       ice_block_obj.cxx          ice_block_obj.hxx \
        info_box_obj.cxx           info_box_obj.hxx \
        laser_exit_obj.cxx         laser_exit_obj.hxx \
        smasher_obj.cxx            smasher_obj.hxx \

Index: info_box_obj.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editorobjs/info_box_obj.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- info_box_obj.cxx    14 Sep 2002 13:35:38 -0000      1.1
+++ info_box_obj.cxx    14 Sep 2002 19:06:34 -0000      1.2
@@ -28,6 +28,11 @@
 {
 }
 
+InfoBoxObj::~InfoBoxObj ()
+{
+  delete data;
+}
+
 EditorObjLst
 InfoBoxObj::create (const CL_Vector& pos)
 {

Index: info_box_obj.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editorobjs/info_box_obj.hxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- info_box_obj.hxx    14 Sep 2002 13:35:38 -0000      1.1
+++ info_box_obj.hxx    14 Sep 2002 19:06:34 -0000      1.2
@@ -35,6 +35,7 @@
 
 public:
   InfoBoxObj (WorldObjsData::InfoBoxData* data_);
+ ~InfoBoxObj ();
 
   static EditorObjLst create (const CL_Vector& pos);
 

Index: switch_door_obj.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editorobjs/switch_door_obj.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- switch_door_obj.cxx 11 Sep 2002 15:27:19 -0000      1.1
+++ switch_door_obj.cxx 14 Sep 2002 19:06:34 -0000      1.2
@@ -29,6 +29,11 @@
 {
 }
 
+SwitchDoorObj::~SwitchDoorObj ()
+{
+  delete data;
+}
+
 EditorObj*
 SwitchDoorObj::duplicate ()
 {

Index: switch_door_obj.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editorobjs/switch_door_obj.hxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- switch_door_obj.hxx 11 Sep 2002 15:27:19 -0000      1.1
+++ switch_door_obj.hxx 14 Sep 2002 19:06:34 -0000      1.2
@@ -37,6 +37,7 @@
   friend class SwitchDoorSwitchObj;
   
   SwitchDoorObj (WorldObjsData::SwitchDoorData* data_);
+ ~SwitchDoorObj ();
   
   /** Create this object (and child objects) with reasonable defaults
       for the editor */

Index: switch_door_switch_obj.hxx
===================================================================
RCS file: 
/usr/local/cvsroot/Games/Pingus/src/editorobjs/switch_door_switch_obj.hxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- switch_door_switch_obj.hxx  11 Sep 2002 15:27:19 -0000      1.1
+++ switch_door_switch_obj.hxx  14 Sep 2002 19:06:34 -0000      1.2
@@ -35,7 +35,7 @@
   
 public:
   SwitchDoorSwitchObj (SwitchDoorObj* data);
-  
+   
   EditorObj* duplicate ();
 
   void write_xml (std::ostream&) {}

Index: teleporter_obj.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editorobjs/teleporter_obj.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- teleporter_obj.cxx  11 Sep 2002 12:45:58 -0000      1.4
+++ teleporter_obj.cxx  14 Sep 2002 19:06:34 -0000      1.5
@@ -33,6 +33,11 @@
   pos_ref = &data->pos;
 }
 
+TeleporterObj::~TeleporterObj ()
+{
+  delete data;
+}
+
 CL_Vector&
 TeleporterObj::get_target_pos_ref ()
 {

Index: teleporter_obj.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/editorobjs/teleporter_obj.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- teleporter_obj.hxx  11 Sep 2002 12:45:58 -0000      1.4
+++ teleporter_obj.hxx  14 Sep 2002 19:06:34 -0000      1.5
@@ -42,6 +42,7 @@
 
 public:
   TeleporterObj (WorldObjsData::TeleporterData* data_);
+ ~TeleporterObj ();
 
   CL_Vector& get_target_pos_ref ();
 





reply via email to

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