pingus-cvs
[Top][All Lists]
Advanced

[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));
   }
 }
 





reply via email to

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