[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs conveyor_belt.cxx,1.13,1.14
From: |
grumbel |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/worldobjs conveyor_belt.cxx,1.13,1.14 conveyor_belt.hxx,1.10,1.11 ice_block.cxx,1.13,1.14 ice_block.hxx,1.9,1.10 switch_door.cxx,1.15,1.16 switch_door.hxx,1.12,1.13 |
Date: |
15 Sep 2002 11:02:26 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/worldobjs
In directory dark:/tmp/cvs-serv3256/worldobjs
Modified Files:
conveyor_belt.cxx conveyor_belt.hxx ice_block.cxx
ice_block.hxx switch_door.cxx switch_door.hxx
Log Message:
- fixed a few crash bugs in switchdoor, iceblock and conveyorbelt
Index: conveyor_belt.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/conveyor_belt.cxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- conveyor_belt.cxx 14 Sep 2002 19:06:34 -0000 1.13
+++ conveyor_belt.cxx 15 Sep 2002 11:02:24 -0000 1.14
@@ -30,22 +30,25 @@
namespace WorldObjs {
ConveyorBelt::ConveyorBelt (WorldObjsData::ConveyorBeltData* data_)
- : data(new WorldObjsData::ConveyorBeltData(*data_))
+ : data(new WorldObjsData::ConveyorBeltData(*data_)),
+ left_sur (PingusResource::load_surface ("conveyorbelt_left",
"worldobjs")),
+ right_sur (PingusResource::load_surface ("conveyorbelt_right",
"worldobjs")),
+ middle_sur(PingusResource::load_surface ("conveyorbelt_middle",
"worldobjs"))
{
}
void
ConveyorBelt::draw (GraphicContext& gc)
{
- gc.draw(data->left_sur, data->pos, static_cast<int>(data->counter));
+ gc.draw(left_sur, data->pos, static_cast<int>(data->counter));
for (int i=0; i < data->width; ++i)
- gc.draw(data->middle_sur,
- static_cast<int>(data->pos.x + data->left_sur.get_width() + i *
data->middle_sur.get_width()),
+ gc.draw(middle_sur,
+ static_cast<int>(data->pos.x + left_sur.get_width() + i *
middle_sur.get_width()),
static_cast<int>(data->pos.y),
static_cast<int>(data->counter));
- gc.draw(data->right_sur,
- static_cast<int>(data->pos.x + data->left_sur.get_width() +
data->width * data->middle_sur.get_width()),
+ gc.draw(right_sur,
+ static_cast<int>(data->pos.x + left_sur.get_width() + data->width *
middle_sur.get_width()),
static_cast<int>(data->pos.y),
static_cast<int>(data->counter));
}
@@ -69,7 +72,7 @@
if (data->counter >= 14.0f)
data->counter = 0.0f;
else if (data->counter < 0.0f)
- data->counter = data->middle_sur.get_num_frames() - 1;
+ data->counter = middle_sur.get_num_frames() - 1;
PinguHolder* holder = world->get_pingu_p();
for (PinguIter pingu = holder->begin(); pingu != holder->end(); ++pingu)
Index: conveyor_belt.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/conveyor_belt.hxx,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- conveyor_belt.hxx 14 Sep 2002 19:06:34 -0000 1.10
+++ conveyor_belt.hxx 15 Sep 2002 11:02:24 -0000 1.11
@@ -34,7 +34,11 @@
{
private:
WorldObjsData::ConveyorBeltData* const data;
-
+
+ CL_Surface left_sur;
+ CL_Surface right_sur;
+ CL_Surface middle_sur;
+
public:
ConveyorBelt (WorldObjsData::ConveyorBeltData* data_);
Index: ice_block.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/ice_block.cxx,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- ice_block.cxx 14 Sep 2002 19:06:34 -0000 1.13
+++ ice_block.cxx 15 Sep 2002 11:02:24 -0000 1.14
@@ -31,10 +31,12 @@
namespace WorldObjs {
-IceBlock::IceBlock (WorldObjsData::IceBlockData* data_) : thickness(1.0),
- is_finished(false),
- last_contact(0),
- data(new
WorldObjsData::IceBlockData(*data_))
+IceBlock::IceBlock (WorldObjsData::IceBlockData* data_)
+ : data(new WorldObjsData::IceBlockData(*data_)),
+ thickness(1.0),
+ is_finished(false),
+ last_contact(0),
+ block_sur(PingusResource::load_surface ("iceblock", "worldobjs"))
{
}
@@ -60,9 +62,9 @@
if (is_finished)
return;
- gc.draw(data->block_sur,
+ gc.draw(block_sur,
data->pos,
- static_cast<int>((1.0 - thickness) *
(data->block_sur.get_num_frames() - 1)));
+ static_cast<int>((1.0 - thickness) * (block_sur.get_num_frames() -
1)));
}
void
@@ -75,8 +77,8 @@
for (PinguIter pingu = holder->begin(); pingu != holder->end(); ++pingu)
{
- if ( (*pingu)->get_x() > data->pos.x && (*pingu)->get_x() <
data->pos.x + data->block_sur.get_width()
- && (*pingu)->get_y() > data->pos.y - 4 && (*pingu)->get_y() <
data->pos.y + data->block_sur.get_height())
+ if ( (*pingu)->get_x() > data->pos.x && (*pingu)->get_x() <
data->pos.x + block_sur.get_width()
+ && (*pingu)->get_y() > data->pos.y - 4 && (*pingu)->get_y() <
data->pos.y + block_sur.get_height())
{
last_contact = world->get_game_time()->get_ticks();
}
Index: ice_block.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/ice_block.hxx,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- ice_block.hxx 14 Sep 2002 19:06:34 -0000 1.9
+++ ice_block.hxx 15 Sep 2002 11:02:24 -0000 1.10
@@ -31,10 +31,12 @@
class IceBlock : public WorldObj
{
private:
+ WorldObjsData::IceBlockData* const data;
+
float thickness;
bool is_finished;
int last_contact;
- WorldObjsData::IceBlockData* const data;
+ CL_Surface block_sur;
public:
IceBlock (WorldObjsData::IceBlockData* data_);
Index: switch_door.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/switch_door.cxx,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- switch_door.cxx 14 Sep 2002 19:06:34 -0000 1.15
+++ switch_door.cxx 15 Sep 2002 11:02:24 -0000 1.16
@@ -24,14 +24,19 @@
#include "../pingu_holder.hxx"
#include "../world.hxx"
#include "../worldobjsdata/switch_door_data.hxx"
+#include "../pingus_resource.hxx"
#include "switch_door.hxx"
namespace WorldObjs {
SwitchDoor::SwitchDoor (WorldObjsData::SwitchDoorData* data_)
- : is_opening(false),
- current_door_height(data->door_height),
- data(new WorldObjsData::SwitchDoorData(*data_))
+ : door_box (PingusResource::load_surface("switchdoor_box" ,
"worldobjs")),
+ door_tile (PingusResource::load_surface("switchdoor_tile" ,
"worldobjs")),
+ door_tile_cmap(PingusResource::load_surface("switchdoor_tile_cmap",
"worldobjs")),
+ switch_sur (PingusResource::load_surface("switchdoor_switch" ,
"worldobjs")),
+ data(new WorldObjsData::SwitchDoorData(*data_)),
+ is_opening(false),
+ current_door_height(data->door_height)
{
}
@@ -43,29 +48,32 @@
void
SwitchDoor::draw_colmap ()
{
- world->get_colmap()->put(data->door_box,
+ world->get_colmap()->put(door_box,
static_cast<int>(data->door_pos.x),
static_cast<int>(data->door_pos.y),
GroundpieceData::GP_SOLID);
for (int i=0; i < data->door_height; ++i)
- world->get_colmap()->put(data->door_tile_cmap,
+ world->get_colmap()->put(door_tile_cmap,
static_cast<int>(data->door_pos.x),
- static_cast<int>(data->door_pos.y) + i *
data->door_tile.get_height()
- +
data->door_box.get_height(),
+ static_cast<int>(data->door_pos.y)
+ + i * door_tile.get_height()
+ + door_box.get_height(),
GroundpieceData::GP_SOLID);
}
void
SwitchDoor::draw (GraphicContext& gc)
{
- gc.draw (data->door_box, data->door_pos);
+ gc.draw (door_box, data->door_pos);
for (int i=0; i < current_door_height; ++i)
- gc.draw(data->door_tile,
+ gc.draw(door_tile,
static_cast<int>(data->door_pos.x),
- static_cast<int>(data->door_pos.y) + i *
data->door_tile.get_height()
- + data->door_box.get_height());
- gc.draw(data->switch_sur, data->switch_pos);
+ static_cast<int>(data->door_pos.y)
+ + i * door_tile.get_height()
+ + door_box.get_height());
+
+ gc.draw(switch_sur, data->switch_pos);
}
void
@@ -81,9 +89,9 @@
for (PinguIter pingu = holder->begin (); pingu != holder->end ();
++pingu)
{
if ((*pingu)->get_x() > data->switch_pos.x
- && (*pingu)->get_x() < data->switch_pos.x +
static_cast<int>(data->switch_sur.get_width())
+ && (*pingu)->get_x() < data->switch_pos.x +
static_cast<int>(switch_sur.get_width())
&& (*pingu)->get_y() > data->switch_pos.y
- && (*pingu)->get_y() < data->switch_pos.y +
static_cast<int>(data->switch_sur.get_height()))
+ && (*pingu)->get_y() < data->switch_pos.y +
static_cast<int>(switch_sur.get_height()))
{
is_opening = true;
}
@@ -98,15 +106,15 @@
// it, we remove the door from the colmap
if (current_door_height + 10 < data->door_height)
{
- world->get_colmap()->put(data->door_box,
+ world->get_colmap()->put(door_box,
static_cast<int>(data->door_pos.x),
static_cast<int>(data->door_pos.y),
GroundpieceData::GP_NOTHING);
for (int i=0; i < data->door_height; ++i)
- world->get_colmap()->put(data->door_tile_cmap,
+ world->get_colmap()->put(door_tile_cmap,
static_cast<int>(data->door_pos.x),
- static_cast<int>(data->door_pos.y) + i
* data->door_tile.get_height()
- +
data->door_box.get_height(),
+ static_cast<int>(data->door_pos.y) + i
* door_tile.get_height()
+ +
door_box.get_height(),
GroundpieceData::GP_NOTHING);
}
}
Index: switch_door.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/switch_door.hxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- switch_door.hxx 14 Sep 2002 19:06:34 -0000 1.12
+++ switch_door.hxx 15 Sep 2002 11:02:24 -0000 1.13
@@ -33,14 +33,19 @@
class SwitchDoor : public WorldObj
{
private:
+ CL_Surface door_box;
+ CL_Surface door_tile;
+ CL_Surface door_tile_cmap;
+ CL_Surface switch_sur;
+
+ WorldObjsData::SwitchDoorData* const data;
+
/** True if the door is opening */
bool is_opening;
/** The current height of the door, it might decrease when the door
is opening, it will be zero when the door is fully opened */
int current_door_height;
-
- WorldObjsData::SwitchDoorData* const data;
public:
SwitchDoor (WorldObjsData::SwitchDoorData* data_);
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/worldobjs conveyor_belt.cxx,1.13,1.14 conveyor_belt.hxx,1.10,1.11 ice_block.cxx,1.13,1.14 ice_block.hxx,1.9,1.10 switch_door.cxx,1.15,1.16 switch_door.hxx,1.12,1.13,
grumbel <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/editorobjs conveyor_belt_obj.cxx,1.1,1.2 conveyor_belt_obj.hxx,1.1,1.2 ice_block_obj.cxx,1.1,1.2 switch_door_obj.cxx,1.2,1.3 switch_door_obj.hxx,1.2,1.3
- Next by Date:
[Pingus-CVS] [Bug #1218] lava animation doesn't look really animated
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/editorobjs conveyor_belt_obj.cxx,1.1,1.2 conveyor_belt_obj.hxx,1.1,1.2 ice_block_obj.cxx,1.1,1.2 switch_door_obj.cxx,1.2,1.3 switch_door_obj.hxx,1.2,1.3
- Next by thread:
[Pingus-CVS] [Bug #1218] lava animation doesn't look really animated
- Index(es):