[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Pingus-CVS] CVS: Games/Pingus/src/particles explosive_particle.cxx,1.3,
From: |
torangan |
Subject: |
[Pingus-CVS] CVS: Games/Pingus/src/particles explosive_particle.cxx,1.3,1.4 ground_particle.cxx,1.1,1.2 smoke_particle.cxx,1.3,1.4 |
Date: |
4 Oct 2002 11:38:31 -0000 |
Update of /usr/local/cvsroot/Games/Pingus/src/particles
In directory dark:/tmp/cvs-serv17475/particles
Modified Files:
explosive_particle.cxx ground_particle.cxx smoke_particle.cxx
Log Message:
- removed a few FIXME
- some minor clean/speed up
Index: explosive_particle.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/particles/explosive_particle.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- explosive_particle.cxx 28 Sep 2002 11:52:25 -0000 1.3
+++ explosive_particle.cxx 4 Oct 2002 11:38:29 -0000 1.4
@@ -38,7 +38,7 @@
}
void
-ExplosiveParticle::update(float delta)
+ExplosiveParticle::update (float delta)
{
Vector new_pos = pos + velocity * delta;
@@ -47,25 +47,26 @@
// FIXME: This thing needs to be more abstract, we just need it far
// to often to reimplement it over and over again.
- while (int(new_pos.x) != int(pos.x)
- || int(new_pos.y) != int(pos.y))
+ while ( static_cast<int>(new_pos.x) != static_cast<int>(pos.x)
+ || static_cast<int>(new_pos.y) != static_cast<int>(pos.y))
{
pos -= incr;
- if (pos.x < 0 || pos.y < 0
+ if ( pos.x < 0
+ || pos.y < 0
|| pos.x + 1 > WorldObj::get_world()->get_width ()
- || pos.y + 1 > WorldObj::get_world()->get_height ())
+ || pos.y + 1 > WorldObj::get_world()->get_height())
{
alive = false;
return;
}
- if (WorldObj::get_world()->get_colmap ()->getpixel ((int) pos.x, (int)
pos.y))
+ if
(WorldObj::get_world()->get_colmap()->getpixel(static_cast<int>(pos.x),
static_cast<int>(pos.y)))
{
- detonate ();
+ detonate();
}
}
-
+
pos = new_pos;
}
Index: ground_particle.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/particles/ground_particle.cxx,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- ground_particle.cxx 12 Jun 2002 19:11:31 -0000 1.1
+++ ground_particle.cxx 4 Oct 2002 11:38:29 -0000 1.2
@@ -21,7 +21,7 @@
#include "../pingus_resource.hxx"
#include "ground_particle.hxx"
-GroundParticle::GroundParticle(int x, int y, float x_a, float y_a)
+GroundParticle::GroundParticle (int x, int y, float x_a, float y_a)
: Particle (x,y, x_a, y_a)
{
surface = PingusResource::load_surface("Particles/ground", "pingus");
@@ -30,7 +30,7 @@
}
void
-GroundParticle::update(float /*delta*/)
+GroundParticle::update (float /*delta*/)
{
pos.x += velocity.x;
pos.y += velocity.y;
@@ -41,18 +41,21 @@
}
void
-GroundParticle::draw_offset(int ofx, int ofy, float s)
+GroundParticle::draw_offset (int ofx, int ofy, float s)
{
if (fast_mode)
return;
if (s == 1.0) {
// FIXME: This segfaults from time to time, don't know why
- surface.put_screen(int(pos.x + ofx - 16), int(pos.y + ofy - 16), 3 -
(livetime * 4 / time));
+ surface.put_screen(static_cast<int>(pos.x + ofx - 16),
+ static_cast<int>(pos.y + ofy - 16),
+ 3 - (livetime * 4 / time));
} else {
- int width = (int)(surface.get_width() * s);
- int height = (int)(surface.get_height() * s);
- surface.put_screen((int)((pos.x + ofx) * s) - width/2, (int)((pos.y + ofy)
* s) - height/2,
+ int width = static_cast<int>(surface.get_width () * s);
+ int height = static_cast<int>(surface.get_height() * s);
+ surface.put_screen(static_cast<int>((pos.x + ofx) * s) - width / 2,
+ static_cast<int>((pos.y + ofy) * s) - height / 2,
width, height, 3 - (livetime * 4 / time));
}
}
Index: smoke_particle.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/particles/smoke_particle.cxx,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- smoke_particle.cxx 28 Jun 2002 17:48:42 -0000 1.3
+++ smoke_particle.cxx 4 Oct 2002 11:38:29 -0000 1.4
@@ -30,7 +30,7 @@
// FIXME: Why the heck do I get an unresolved reference in
// WoodThing.cc when I try to use SmokeParticle there?!
-SmokeParticle::SmokeParticle(int x, int y, float x_a, float y_a)
+SmokeParticle::SmokeParticle (int x, int y, float x_a, float y_a)
: Particle (x, y, x_a, y_a)
{
// FIXME: Probably slow??
@@ -52,7 +52,7 @@
}
void
-SmokeParticle::update(float /*delta*/)
+SmokeParticle::update (float delta)
{
pos.x += velocity.x;
pos.y += velocity.y;
@@ -60,6 +60,8 @@
if (livetime > 0)
--livetime;
+
+ UNUSED_ARG(delta);
}
void
@@ -70,14 +72,15 @@
if (s == 1.0) {
// FIXME: This segfaults from time to time, don't know why
- surface.put_screen(int(pos.x + ofx - 16), int(pos.y + ofy - 16),
+ surface.put_screen(static_cast<int>(pos.x + ofx - 16),
+ static_cast<int>(pos.y + ofy - 16),
3 - (livetime * 4 / time));
} else {
- int width = (int)(surface.get_width() * s);
- int height = (int)(surface.get_height() * s);
- surface.put_screen((int)((pos.x + ofx) * s) - width/2,
- (int)((pos.y + ofy) * s) - height/2,
- width, height, 3 - (livetime * 4 / time));
+ int width = static_cast<int>(surface.get_width() * s);
+ int height = static_cast<int>(surface.get_height() * s);
+ surface.put_screen(static_cast<int>((pos.x + ofx) * s) - width / 2,
+ static_cast<int>((pos.y + ofy) * s) - height / 2,
+ width, height, 3 - (livetime * 4 / time));
}
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Pingus-CVS] CVS: Games/Pingus/src/particles explosive_particle.cxx,1.3,1.4 ground_particle.cxx,1.1,1.2 smoke_particle.cxx,1.3,1.4,
torangan <=
- Prev by Date:
[Pingus-CVS] CVS: Games/Pingus/src/editor editor.cxx,1.36,1.37 editorobj_group.cxx,1.6,1.7 rect_editorobj.cxx,1.7,1.8
- Next by Date:
[Pingus-CVS] CVS: Games/Pingus/src action_button.cxx,1.14,1.15 action_holder.cxx,1.5,1.6 action_holder.hxx,1.7,1.8 capture_rectangle.cxx,1.9,1.10 capture_rectangle.hxx,1.5,1.6 pingu.cxx,1.31,1.32 pingus_main.cxx,1.21,1.22
- Previous by thread:
[Pingus-CVS] CVS: Games/Pingus/src/editor editor.cxx,1.36,1.37 editorobj_group.cxx,1.6,1.7 rect_editorobj.cxx,1.7,1.8
- Next by thread:
[Pingus-CVS] CVS: Games/Pingus/src action_button.cxx,1.14,1.15 action_holder.cxx,1.5,1.6 action_holder.hxx,1.7,1.8 capture_rectangle.cxx,1.9,1.10 capture_rectangle.hxx,1.5,1.6 pingu.cxx,1.31,1.32 pingus_main.cxx,1.21,1.22
- Index(es):