[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] r2607 - in trunk/src: components display particles worldobj
From: |
jave27 |
Subject: |
[Pingus-CVS] r2607 - in trunk/src: components display particles worldobjs |
Date: |
Wed, 18 Jan 2006 23:07:55 +0100 |
Author: jave27
Date: 2006-01-18 23:07:42 +0100 (Wed, 18 Jan 2006)
New Revision: 2607
Modified:
trunk/src/components/smallmap.cxx
trunk/src/display/drawing_context.cxx
trunk/src/display/drawing_context.hxx
trunk/src/particles/pingu_particle_holder.cxx
trunk/src/worldobjs/conveyor_belt.cxx
trunk/src/worldobjs/fake_exit.cxx
trunk/src/worldobjs/groundpiece.hxx
trunk/src/worldobjs/ice_block.cxx
trunk/src/worldobjs/ice_block.hxx
trunk/src/worldobjs/laser_exit.cxx
trunk/src/worldobjs/smasher.cxx
trunk/src/worldobjs/surface_background.cxx
trunk/src/worldobjs/teleporter.hxx
trunk/src/worldobjs/woodthing.cxx
Log:
Updated some syntax - removed GameCounter option from the draw(sprite...)
functions since it shouldn't be used anyway.
Removed Z handling from the SpriteDrawingRequests because sprites with a
negative Z value weren't being drawn. This needs to be fixed correctly, but
this is a workaround for now.
Modified: trunk/src/components/smallmap.cxx
===================================================================
--- trunk/src/components/smallmap.cxx 2006-01-18 20:28:38 UTC (rev 2606)
+++ trunk/src/components/smallmap.cxx 2006-01-18 22:07:42 UTC (rev 2607)
@@ -88,7 +88,7 @@
Playfield* playfield = client->get_playfield();
- gc.draw(image->get_surface(), Vector(x_pos, y_pos));
+ gc.draw(image->get_surface(), Vector((float)x_pos, (float)y_pos));
CL_Point of = playfield->get_pos();
@@ -98,8 +98,8 @@
int w = Math::min(rwidth, int(width - 1));
int h = Math::min(rheight, int(height - 1));
- gc.draw_rect(of.x - w/2, of.y - h/2,
- of.x + w/2, of.y + h/2,
+ gc.draw_rect(float(of.x - w/2), float(of.y - h/2),
+ float(of.x + w/2), float(of.y + h/2),
CL_Color(0, 255, 0));
client->get_server()->get_world()->draw_smallmap(this);
@@ -112,10 +112,7 @@
int x = static_cast<int>(x_pos + ((*i)->get_x() * width /
world->get_colmap()->get_width()));
int y = static_cast<int>(y_pos + ((*i)->get_y() * height /
world->get_colmap()->get_height()));
- //FIXME: Replace this with draw_pixel (only availabe in 0.7)
- gc.draw_line(x, y, x, y, CL_Color(255, 255, 0));
- gc.draw_line(x, y-1, x, y-1, CL_Color(255, 255, 0));
- gc.draw_line(x, y-2, x, y-2, CL_Color(255, 255, 0));
+ gc.draw_line((float)x, (float)y, (float)x, (float)y-2, CL_Color(255,
255, 0));
}
gc_ptr = 0;
Modified: trunk/src/display/drawing_context.cxx
===================================================================
--- trunk/src/display/drawing_context.cxx 2006-01-18 20:28:38 UTC (rev
2606)
+++ trunk/src/display/drawing_context.cxx 2006-01-18 22:07:42 UTC (rev
2607)
@@ -253,9 +253,12 @@
}
void
-DrawingContext::draw(const CL_Sprite& sprite, const Vector& pos, int frame)
+DrawingContext::draw(const CL_Sprite& sprite, const Vector& pos)
{
- draw(sprite, pos.x, pos.y, pos.z);
+ // FIXME: Z handling isn't working correctly - sprite with negative Z values
+ // FIXME: aren't being displayed.
+ //draw(sprite, pos.x, pos.y, pos.z);
+ draw(sprite, pos.x, pos.y, 0);
}
void
Modified: trunk/src/display/drawing_context.hxx
===================================================================
--- trunk/src/display/drawing_context.hxx 2006-01-18 20:28:38 UTC (rev
2606)
+++ trunk/src/display/drawing_context.hxx 2006-01-18 22:07:42 UTC (rev
2607)
@@ -74,7 +74,7 @@
void draw(const CL_Sprite& sprite, float x, float y, float z = 0);
void draw(const std::string& text, float x, float y, float z = 0);
- void draw(const CL_Sprite&, const Vector& pos, int frame = -1);
+ void draw(const CL_Sprite&, const Vector& pos);
void draw_line (float x1, float y1, float x2, float y2,
const CL_Color& color, float z = 0);
Modified: trunk/src/particles/pingu_particle_holder.cxx
===================================================================
--- trunk/src/particles/pingu_particle_holder.cxx 2006-01-18 20:28:38 UTC
(rev 2606)
+++ trunk/src/particles/pingu_particle_holder.cxx 2006-01-18 22:07:42 UTC
(rev 2607)
@@ -161,7 +161,7 @@
if (!it->livetime)
continue;
- gc.color().draw(surface, it->pos, it->use_frame2);
+ gc.color().draw(surface, it->pos);
}
}
Modified: trunk/src/worldobjs/conveyor_belt.cxx
===================================================================
--- trunk/src/worldobjs/conveyor_belt.cxx 2006-01-18 20:28:38 UTC (rev
2606)
+++ trunk/src/worldobjs/conveyor_belt.cxx 2006-01-18 22:07:42 UTC (rev
2607)
@@ -41,17 +41,15 @@
void
ConveyorBelt::draw (SceneContext& gc)
{
- gc.color().draw(left_sur, pos, static_cast<int>(counter));
+ gc.color().draw(left_sur, pos);
for (int i=0; i < width; ++i)
gc.color().draw(middle_sur,
Vector(static_cast<int>(pos.x + left_sur.get_width() + i *
middle_sur.get_width()),
- static_cast<int>(pos.y)),
- static_cast<int>(counter));
+ static_cast<int>(pos.y)));
gc.color().draw(right_sur,
Vector(static_cast<int>(pos.x + left_sur.get_width() + width *
middle_sur.get_width()),
- static_cast<int>(pos.y)),
- static_cast<int>(counter));
+ static_cast<int>(pos.y)));
}
void
@@ -69,20 +67,17 @@
void
ConveyorBelt::update ()
{
- counter += speed * 0.025f;
+ left_sur.update();
+ middle_sur.update();
+ right_sur.update();
- if (counter >= 14.0f)
- counter = 0.0f;
- else if (counter < 0.0f)
- counter = middle_sur.get_frame_count() - 1;
-
PinguHolder* holder = world->get_pingus();
for (PinguIter pingu = holder->begin(); pingu != holder->end(); ++pingu)
{
- if ( (*pingu)->get_x() > pos.x
- && (*pingu)->get_x() < pos.x + 15 * (width + 2)
- && (*pingu)->get_y() > pos.y - 2
- && (*pingu)->get_y() < pos.y + 10)
+ if ( (*pingu)->get_pos().x > pos.x
+ && (*pingu)->get_pos().x < pos.x + 15 * (width + 2)
+ && (*pingu)->get_pos().y > pos.y - 2
+ && (*pingu)->get_pos().y < pos.y + 10)
{
Vector pos = (*pingu)->get_pos();
pos.x -= speed * 0.025f;
Modified: trunk/src/worldobjs/fake_exit.cxx
===================================================================
--- trunk/src/worldobjs/fake_exit.cxx 2006-01-18 20:28:38 UTC (rev 2606)
+++ trunk/src/worldobjs/fake_exit.cxx 2006-01-18 22:07:42 UTC (rev 2607)
@@ -52,7 +52,7 @@
void
FakeExit::draw (SceneContext& gc)
{
- gc.color().draw (surface, pos, counter.value());
+ gc.color().draw (surface, pos);
}
Modified: trunk/src/worldobjs/groundpiece.hxx
===================================================================
--- trunk/src/worldobjs/groundpiece.hxx 2006-01-18 20:28:38 UTC (rev 2606)
+++ trunk/src/worldobjs/groundpiece.hxx 2006-01-18 22:07:42 UTC (rev 2607)
@@ -46,7 +46,7 @@
public:
Groundpiece(const FileReader& reader);
- float get_z_pos () const { return 0; }
+ float get_z_pos () const { return pos.z; }
void draw (SceneContext&) {}
void on_startup ();
Modified: trunk/src/worldobjs/ice_block.cxx
===================================================================
--- trunk/src/worldobjs/ice_block.cxx 2006-01-18 20:28:38 UTC (rev 2606)
+++ trunk/src/worldobjs/ice_block.cxx 2006-01-18 22:07:42 UTC (rev 2607)
@@ -58,8 +58,8 @@
return;
gc.color().draw(block_sur,
- pos,
- static_cast<int>((1.0 - thickness) * (block_sur.get_frame_count() -
1)));
+ pos);
+ //, static_cast<int>((1.0 - thickness)
* (block_sur.get_frame_count() - 1)));
}
void
Modified: trunk/src/worldobjs/ice_block.hxx
===================================================================
--- trunk/src/worldobjs/ice_block.hxx 2006-01-18 20:28:38 UTC (rev 2606)
+++ trunk/src/worldobjs/ice_block.hxx 2006-01-18 22:07:42 UTC (rev 2607)
@@ -48,7 +48,7 @@
public:
IceBlock(const FileReader& reader);
- float get_z_pos () const { return 100; }
+ float get_z_pos () const { return pos.z; }
void on_startup ();
void draw (SceneContext& gc);
void update ();
Modified: trunk/src/worldobjs/laser_exit.cxx
===================================================================
--- trunk/src/worldobjs/laser_exit.cxx 2006-01-18 20:28:38 UTC (rev 2606)
+++ trunk/src/worldobjs/laser_exit.cxx 2006-01-18 22:07:42 UTC (rev 2607)
@@ -46,8 +46,7 @@
void
LaserExit::draw (SceneContext& gc)
{
- gc.color().draw (surface, pos,
- counter.value());
+ gc.color().draw (surface, pos);
}
void
Modified: trunk/src/worldobjs/smasher.cxx
===================================================================
--- trunk/src/worldobjs/smasher.cxx 2006-01-18 20:28:38 UTC (rev 2606)
+++ trunk/src/worldobjs/smasher.cxx 2006-01-18 22:07:42 UTC (rev 2607)
@@ -118,7 +118,7 @@
void
Smasher::draw (SceneContext& gc)
{
- gc.color().draw (surface, pos, count);
+ gc.color().draw (surface, pos);
}
void
Modified: trunk/src/worldobjs/surface_background.cxx
===================================================================
--- trunk/src/worldobjs/surface_background.cxx 2006-01-18 20:28:38 UTC (rev
2606)
+++ trunk/src/worldobjs/surface_background.cxx 2006-01-18 22:07:42 UTC (rev
2607)
@@ -44,10 +44,8 @@
scroll_ox(0),
scroll_oy(0)
{
- pos.z = -150;
+ reader.read_vector("position", pos);
- reader.read_vector("position", pos);
-
ResDescriptor desc;
reader.read_desc("surface", desc);
@@ -106,24 +104,6 @@
}
}
- /* FIXME: Not sure why the following code is here - commenting it out fixes
- FIXME: the issue with the line separating scrolling
backgrounds.
-
- FIXME: fill_rect doesn't work with RGB images
- FIXME: seems to work fine with indexed images
- FIXME: not tested with RGBA images
- FIXME: the bug might be in create_canvas() and not in fill_rect()
-
-
- if (color.alpha != 0.0 && color != CL_Colorf(0, 0, 0, 1.0f))
-
- { // Workaround for a bug which caused all levels to have the
- // wrong background color
- Blitter::fill_rect(canvas, CL_Rect(0, 0, canvas.get_width(),
canvas.get_height()),
- CL_Color(color));
- }
- */
-
CL_SpriteDescription sprite_desc;
sprite_desc.add_frame(canvas);
bg_surface = CL_Sprite(sprite_desc);
Modified: trunk/src/worldobjs/teleporter.hxx
===================================================================
--- trunk/src/worldobjs/teleporter.hxx 2006-01-18 20:28:38 UTC (rev 2606)
+++ trunk/src/worldobjs/teleporter.hxx 2006-01-18 22:07:42 UTC (rev 2607)
@@ -43,11 +43,9 @@
public:
Teleporter(const FileReader& reader);
- int get_z_pos () { return 0; }
-
void draw (SceneContext& gc);
void update ();
- float get_z_pos () const;
+ float get_z_pos () const;
private:
Teleporter (const Teleporter&);
Modified: trunk/src/worldobjs/woodthing.cxx
===================================================================
--- trunk/src/worldobjs/woodthing.cxx 2006-01-18 20:28:38 UTC (rev 2606)
+++ trunk/src/worldobjs/woodthing.cxx 2006-01-18 22:07:42 UTC (rev 2607)
@@ -61,8 +61,7 @@
{
gc.color().draw(surface,
Vector(pos.x - surface.get_width () / 2,
- pos.y - surface.get_height() + 32),
- (int)counter);
+ pos.y - surface.get_height() + 32));
}
} // namespace Entrances
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] r2607 - in trunk/src: components display particles worldobjs,
jave27 <=