pingus-cvs
[Top][All Lists]
Advanced

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

[Pingus-CVS] CVS: Games/Pingus/src/actions digger.cxx,1.18,1.19 digger.h


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/actions digger.cxx,1.18,1.19 digger.hxx,1.12,1.13 faller.cxx,1.30,1.31
Date: 20 Oct 2002 18:28:51 -0000

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

Modified Files:
        digger.cxx digger.hxx faller.cxx 
Log Message:
applied several patches


Index: digger.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/digger.cxx,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -d -r1.18 -r1.19
--- digger.cxx  13 Oct 2002 20:25:00 -0000      1.18
+++ digger.cxx  20 Oct 2002 18:28:49 -0000      1.19
@@ -43,6 +43,12 @@
                   "pingus", PropertyMgr::instance()->get_int 
("actions/digger/sprite-fps", 20));
 #endif
   sprite.set_align_center_bottom();
+  
+  digger_radius_width  = digger_radius.get_width();
+  digger_radius_height = digger_radius.get_height();
+  
+  digger_radius_gfx_width  = digger_radius_gfx.get_width();
+  digger_radius_gfx_height = digger_radius_gfx.get_height();
 }
 
 void
@@ -86,11 +92,11 @@
 Digger::dig ()
 {
   WorldObj::get_world()->get_colmap()->remove(digger_radius, 
-                                             static_cast<int>(pingu->get_x () 
- 16),
-                                             static_cast<int>(pingu->get_y() - 
14));
+                                             static_cast<int>(pingu->get_x() - 
(digger_radius_width / 2)),
+                                             static_cast<int>(pingu->get_y() - 
digger_radius_height + 2));
   WorldObj::get_world()->get_gfx_map()->remove(digger_radius_gfx,
-                                              static_cast<int>(pingu->get_x () 
- 16),
-                                              static_cast<int>(pingu->get_y() 
- 14));
+                                              static_cast<int>(pingu->get_x () 
- (digger_radius_gfx_width / 2)),
+                                              static_cast<int>(pingu->get_y() 
- digger_radius_gfx_height + 2));
       
   pingu->set_y(pingu->get_y() + 1);
 }

Index: digger.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/digger.hxx,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- digger.hxx  13 Oct 2002 16:40:01 -0000      1.12
+++ digger.hxx  20 Oct 2002 18:28:49 -0000      1.13
@@ -33,6 +33,18 @@
   Sprite sprite;
   int digger_c;
 
+  /** Width of the digger_radius surface */
+  unsigned int digger_radius_width;
+
+  /** Height of the digger_radius surface */
+  unsigned int digger_radius_height;
+
+  /** Width of the digger_radius_gfx surface */
+  unsigned int digger_radius_gfx_width;
+
+  /** Height of the digger_radius_gfx surface */
+  unsigned int digger_radius_gfx_height;
+
 public:
   Digger(Pingu*);
     

Index: faller.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/faller.cxx,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- faller.cxx  13 Oct 2002 20:25:00 -0000      1.30
+++ faller.cxx  20 Oct 2002 18:28:49 -0000      1.31
@@ -20,7 +20,6 @@
 #include <math.h>
 #include "../col_map.hxx"
 #include "../debug.hxx"
-#include "../force_vector.hxx"
 #include "../globals.hxx"
 #include "../graphic_context.hxx"
 #include "../pingu.hxx"
@@ -63,46 +62,9 @@
   if (pingu->get_velocity().y > 5.0 && pingu->request_fall_action())
     return;
 
-  // Apply all forces
-  pingu->set_velocity(ForcesHolder::apply_forces(pingu->get_pos(), 
pingu->get_velocity()));
-    
-  Vector newp = pingu->get_velocity();
-  
-  // Update x and y by moving the penguin to it's target *slowly*
-  // and checking if the penguin has hit the bottom at each loop
-  while (  rel_getpixel(0, -1) == Groundtype::GP_NOTHING
-       && (fabs(newp.x) >= 1 || fabs(newp.y) >= 1))
-    {
-      if (fabs(newp.x) >= 1)
-       { 
-         // Since the velocity might be a
-         // fraction stop when we are within 1 unit of the target
-         if (newp.x > 0)
-           {
-             pingu->set_x(pingu->get_x() + 1);
-             newp.x--;
-           }
-         else
-           {
-             pingu->set_x(pingu->get_x() - 1);
-             newp.x++;
-           }
-       }
-
-      if (fabs(newp.y) >= 1)
-       {
-         if (newp.y > 0)
-           {
-             pingu->set_y(pingu->get_y() + 1);
-             newp.y--;
-           }
-         else 
-           {
-             pingu->set_y(pingu->get_y() - 1);
-             newp.y++;
-           }
-       }
-    }
+  // Move the Faller according to the forces that currently exist, which
+  // includes gravity.
+  move_with_forces (0.0, 0.0);
 
   // Now that the Pingu is moved, check if he hits the ground.
   if (rel_getpixel(0, -1) == Groundtype::GP_NOTHING)
@@ -114,7 +76,8 @@
     }
   else // Ping is on ground/water/something
     {
-      if (rel_getpixel(0, -1) == Groundtype::GP_WATER)
+      if (   rel_getpixel(0, -1) == Groundtype::GP_WATER
+         || rel_getpixel(0, -1) == Groundtype::GP_LAVA) 
        {
          pingu->set_action(Actions::Drown);
          return;





reply via email to

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