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 bridger.cxx,1.4,1.5 bridger.h


From: torangan
Subject: [Pingus-CVS] CVS: Games/Pingus/src/actions bridger.cxx,1.4,1.5 bridger.hxx,1.4,1.5
Date: 26 Jun 2002 10:48:21 -0000

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

Modified Files:
        bridger.cxx bridger.hxx 
Log Message:
modifications to prevent jumping of the sprite (Bug 605)


Index: bridger.cxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/bridger.cxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- bridger.cxx 25 Jun 2002 18:15:18 -0000      1.4
+++ bridger.cxx 26 Jun 2002 10:48:19 -0000      1.5
@@ -36,17 +36,13 @@
 CL_Surface Bridger::brick_r;
 CL_Surface Bridger::static_surface;
 
-Bridger::Bridger() : bricks(15), block_build(false), mode(B_BUILDING) 
+Bridger::Bridger() : bricks(MAX_BRICKS), block_build(false), mode(B_BUILDING) 
 {
 }
 
 void
 Bridger::init(void)
 {
-  bricks = 15;
-  mode = B_BUILDING;
-  block_build = false;
-
   if (!static_surfaces_loaded)
     {
       static_surface = PingusResource::load_surface ("Pingus/bridger0", 
"pingus");
@@ -67,6 +63,18 @@
 void
 Bridger::draw_offset(int x, int y, float /*s*/)
 {
+
+  int x_offset(6), y_offset(4);
+
+  if (bricks == MAX_BRICKS) {
+    x_offset = -2;
+    y_offset = 0;
+    
+  } else if (bricks == MAX_BRICKS - 1) {
+    x_offset = 3;
+    y_offset = 2;
+  }
+
   switch (mode)
     {
     case B_BUILDING:
@@ -75,8 +83,8 @@
       else
        build_sprite.set_direction (Sprite::RIGHT);
       
-      build_sprite.put_screen(pingu->get_x () + x - (6*pingu->direction),
-                             pingu->get_y () + y + 4);
+      build_sprite.put_screen(pingu->get_x () + x - (x_offset * 
pingu->direction),
+                             pingu->get_y () + y + y_offset);
       break;
       
     case B_WALKING:
@@ -85,8 +93,8 @@
       else
        walk_sprite.set_direction (Sprite::RIGHT);
       
-      walk_sprite.put_screen(pingu->get_x () + x - (6*pingu->direction),
-                             pingu->get_y () + y + 5);
+      walk_sprite.put_screen(pingu->get_x () + x - (x_offset * 
pingu->direction),
+                             pingu->get_y () + y + y_offset);
       break;
     }
 }

Index: bridger.hxx
===================================================================
RCS file: /usr/local/cvsroot/Games/Pingus/src/actions/bridger.hxx,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- bridger.hxx 24 Jun 2002 22:52:57 -0000      1.4
+++ bridger.hxx 26 Jun 2002 10:48:19 -0000      1.5
@@ -48,6 +48,7 @@
   CL_Vector last_pos;
 
   enum Mode { B_WALKING, B_BUILDING } mode;
+  enum { MAX_BRICKS = 15 };
 public:
   Bridger();
 




reply via email to

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