pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src/worldobjs rain_generator.cxx,1.6,1.7


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/worldobjs rain_generator.cxx,1.6,1.7 smasher.cxx,1.14,1.15 snow_generator.cxx,1.4,1.5
Date: 28 Dec 2002 16:10:20 -0000

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

Modified Files:
        rain_generator.cxx smasher.cxx snow_generator.cxx 
Log Message:
rewrite of particle system


Index: rain_generator.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/rain_generator.cxx,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- rain_generator.cxx  14 Oct 2002 11:15:15 -0000      1.6
+++ rain_generator.cxx  28 Dec 2002 16:10:18 -0000      1.7
@@ -19,8 +19,7 @@
 
 #include <iostream>
 #include <ClanLib/Display/Display/display.h>
-#include "../particles/particle_holder.hxx"
-#include "../particles/rain_particle.hxx"
+#include "../particles/rain_particle_holder.hxx"
 #include "../sound.hxx"
 #include "../world.hxx"
 #include "../graphic_context.hxx"
@@ -44,9 +43,9 @@
   if (do_thunder)
     {
       if (thunder_count < 0.0f) {
-       do_thunder = false;
-       thunder_count = 0.0f;
-       waiter_count = 1.0f;
+       do_thunder = false;
+       thunder_count = 0.0f;
+       waiter_count = 1.0f;
       }
 
       gc.draw_fillrect (0, 0, CL_Display::get_width (), CL_Display::get_height 
(),
@@ -71,14 +70,8 @@
 
   waiter_count -= 20.0f * 0.025f;
 
-  get_world()->get_particle_holder()->add_particle(new RainParticle(rand() % 
world->get_width(), -32));
-  get_world()->get_particle_holder()->add_particle(new RainParticle(rand() % 
world->get_width(), -32));
-  get_world()->get_particle_holder()->add_particle(new RainParticle(rand() % 
world->get_width(), -32));
-  get_world()->get_particle_holder()->add_particle(new RainParticle(rand() % 
world->get_width(), -32));
-  get_world()->get_particle_holder()->add_particle(new RainParticle(rand() % 
world->get_width(), -32));
-  get_world()->get_particle_holder()->add_particle(new RainParticle(rand() % 
world->get_width(), -32));
-  get_world()->get_particle_holder()->add_particle(new RainParticle(rand() % 
world->get_width(), -32));
-  get_world()->get_particle_holder()->add_particle(new RainParticle(rand() % 
world->get_width(), -32));
+  for (int i=0; i < 16; ++i)
+    world->get_rain_particle_holder()->add_particle(rand() % 
(world->get_width() * 2), -32);
 }
 
 } // namespace WorldObjs

Index: smasher.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/smasher.cxx,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- smasher.cxx 13 Oct 2002 20:25:00 -0000      1.14
+++ smasher.cxx 28 Dec 2002 16:10:18 -0000      1.15
@@ -21,8 +21,7 @@
 #include "../algo.hxx"
 #include "../col_map.hxx"
 #include "../graphic_context.hxx"
-#include "../particles/smoke_particle.hxx"
-#include "../particles/particle_holder.hxx"
+#include "../particles/smoke_particle_holder.hxx"
 #include "../pingu.hxx"
 #include "../pingu_holder.hxx"
 #include "../pingus_resource.hxx"
@@ -63,49 +62,48 @@
   if (smashing) 
     {
       if (downwards) 
-       {
-         if (count >= 5) 
-           {
-             // SMASH!!! The thing hitten earth and kills the pingus
-             downwards = false;
-             --count; 
-             PingusSound::play_sound("sounds/tenton.wav", 0.7f);
+             {
+               if (count >= 5) 
+                 {
+                   // SMASH!!! The thing hitten earth and kills the pingus
+                   downwards = false;
+                   --count; 
+                   PingusSound::play_sound("sounds/tenton.wav", 0.7f);
            
-             for(int i=0; i < 20; ++i)
-               {
-                 world->get_particle_holder()
-                   ->add_particle(
-                                  new 
SmokeParticle(static_cast<int>(data->pos.x + 20 + rand() % 260),
-                                                    
static_cast<int>(data->pos.y + 180),
-                                                    frand()-0.5, frand()-0.5));
-               }
+                   for(int i=0; i < 20; ++i)
+                           {
+                             
world->get_smoke_particle_holder()->add_particle(static_cast<int>(data->pos.x + 
20 + rand() % 260),
+                                                                               
                       static_cast<int>(data->pos.y + 180),
+                                                                               
                       frand()-0.5, frand()-0.5);
+                           }
 
-             for (PinguIter pingu = holder->begin (); pingu != holder->end (); 
++pingu)
-               {
-                 if ((*pingu)->is_inside(static_cast<int>(data->pos.x + 30),
-                                         static_cast<int>(data->pos.y + 90),
-                                         static_cast<int>(data->pos.x + 250),
-                                         static_cast<int>(data->pos.y + 190)))
-                   {
-                     if ((*pingu)->get_action() != Actions::Splashed)
-                       (*pingu)->set_action(Actions::Splashed);
-                   }
-               }
-           }
-         else 
-           {
-             ++count;
-           }
-       } 
+                   for (PinguIter pingu = holder->begin (); pingu != 
holder->end (); ++pingu)
+                           {
+                             if 
((*pingu)->is_inside(static_cast<int>(data->pos.x + 30),
+                                                     
static_cast<int>(data->pos.y + 90),
+                                                     
static_cast<int>(data->pos.x + 250),
+                                                     
static_cast<int>(data->pos.y + 190)))
+                               {
+                                 if ((*pingu)->get_action() != 
Actions::Splashed)
+                                   (*pingu)->set_action(Actions::Splashed);
+                               }
+                           }
+                 }
+               else 
+                 {
+                   ++count;
+                 }
+             } 
       else 
-       {
-         if (count <= 0) {
-           count = 0;
-           smashing = false;
-         } else {
-           --count;
-         }
-       }
+             {
+               if (count <= 0)
+                       {
+                   count = 0;
+                   smashing = false;
+                 } else {
+                   --count;
+                 }
+             }
     }
 }
 

Index: snow_generator.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/worldobjs/snow_generator.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- snow_generator.cxx  1 Oct 2002 19:53:46 -0000       1.4
+++ snow_generator.cxx  28 Dec 2002 16:10:18 -0000      1.5
@@ -18,8 +18,7 @@
 //  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 
 #include "../world.hxx"
-#include "../particles/snow_particle.hxx"
-#include "../particles/particle_holder.hxx"
+#include "../particles/snow_particle_holder.hxx"
 #include "snow_generator.hxx"
 
 namespace WorldObjs {
@@ -35,9 +34,9 @@
 void 
 SnowGenerator::update()
 {
-  world->get_particle_holder()->add_particle(new SnowParticle(rand() % 
world->get_width(), -32));
-  world->get_particle_holder()->add_particle(new SnowParticle(rand() % 
world->get_width(), -32));
-  world->get_particle_holder()->add_particle(new CollidingSnowParticle(rand() 
% world->get_width(), -32));
+  world->get_snow_particle_holder()->add_particle(rand() % world->get_width(), 
-32);
+  world->get_snow_particle_holder()->add_particle(rand() % world->get_width(), 
-32);
+  world->get_snow_particle_holder()->add_particle(rand() % world->get_width(), 
-32, true);
 }
 
 void
@@ -45,12 +44,9 @@
 {
   for (int i = 0; i < 500; ++i) // FIXME: 500 is a random value, doesn't work 
very often
     {
-      world->get_particle_holder()->add_particle(new SnowParticle(rand() % 
world->get_width(), 
-                                                                 rand() % 
world->get_height()));
-      world->get_particle_holder()->add_particle(new SnowParticle(rand() % 
world->get_width(), 
-                                                                 rand() % 
world->get_height()));
-      world->get_particle_holder()->add_particle(new 
CollidingSnowParticle(rand() % world->get_width(), 
-                                                                          
rand() % world->get_height())); 
+      world->get_snow_particle_holder()->add_particle(rand() % 
world->get_width(), rand() % world->get_height());
+      world->get_snow_particle_holder()->add_particle(rand() % 
world->get_width(), rand() % world->get_height());
+      world->get_snow_particle_holder()->add_particle(rand() % 
world->get_width(), rand() % world->get_height(), true); 
     }
 }
 




reply via email to

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