Package: tecnoballz
Version: 0.92-2.1
Severity: normal
Tags: patch

The paddle controller compute itself the relative mouse movment. i.e.
it substract the previous absolute position and the actual absolute
position.
A problem occures when under "inversor malus" because the absolute
position may be on left or right position and can't go farther.

I'm not sure to be clear.
You move your mouse to the right (up to the right edge of the screen).
Then you get an inversor malus. Thus to move the paddle on left, you
have to move the mouse on the right. But there won't be any relative
movment since the cursor can't go farther on the right.

There are two way to fix this.
The first-one (the one I implemented) consist in using relative mouse
motion informations given by the SDL_MouseMotionEvent. Howerver, this
behaviour when on edge is only implemented in SDL for Windows, Linux and
Unix-like systems.
The second way would be to place the mouse in the middle of the screen
every time it moves. But this placement should be done while mouseMotion
events are ignored since SDL_WarpMouse generate such an event.


NB : the patch I provide is a diff against my previously patched copy
(see the "garbage bug").

It includes :
- The correction for relative movments (obviously)
- Yet a few spelling fixes
- A few "virtual" key word for destructors (absence of virtual may lead
to memory leak)
- A few compile-warning fixes.


That's all.

Celelibi


-- System Information:
Debian Release: 5.0
  APT prefers testing
  APT policy: (990, 'testing'), (600, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.23.9 (SMP w/2 CPU cores; PREEMPT)
Locale: LANG=fr_FR, LC_CTYPE=fr_FR (charmap=ISO-8859-1)
Shell: /bin/sh linked to /bin/bash

Versions of packages tecnoballz depends on:
ii  libc6              2.7-16                GNU C Library: Shared libraries
ii  libgcc1            1:4.3.2-1             GCC support library
ii  libmikmod2         3.1.11-a-6            A portable sound library
ii  libogg0            1.1.3-4               Ogg Bitstream Library
ii  libsdl-image1.2    1.2.6-3               image loading library for Simple D
ii  libsdl-mixer1.2    1.2.8-4               mixer library for Simple DirectMed
ii  libsdl1.2debian    1.2.13-2              Simple DirectMedia Layer
ii  libsmpeg0          0.4.5+cvs20030824-2.2 SDL MPEG Player Library - shared l
ii  libstdc++6         4.3.2-1               The GNU Standard C++ Library v3
ii  libvorbisfile3     1.2.0.dfsg-3.1        The Vorbis General Audio Compressi
ii  tecnoballz-data    0.92-2.1              graphic, sound and music files for

tecnoballz recommends no packages.

tecnoballz suggests no packages.

-- no debconf information
diff -Naur tecnoballz-no-garbage/include/controller_bricks.h tecnoballz-move-inverted/include/controller_bricks.h
--- tecnoballz-no-garbage/include/controller_bricks.h	2009-01-02 04:16:05.000000000 +0100
+++ tecnoballz-move-inverted/include/controller_bricks.h	2009-01-03 16:51:54.000000000 +0100
@@ -165,10 +165,10 @@
   /** Pixels offset on the first indestructible brick */
   Sint32 indestructible_offset;
   Sint32 brkyoffset;            //y-offset between 2 bricks 
-  Sint32 ombre_deca;            //size of shadow in pixels (3 or 6)
-  Sint32 ombre_left;            //(4 or 8)
-  Sint32 ombre_yoff;            //space between 2 bricks (1 or 2)
-  Sint32 ombre_top1;            //(2 or 4)
+  Sint32 shadow_offset;         //size of shadow in pixels (3 or 6)
+  Sint32 shadow_left;           //(4 or 8)
+  Sint32 shadow_yoff;           //space between 2 bricks (1 or 2)
+  Sint32 shadow_top1;           //(2 or 4)
   brick_redraw * bricks_redraw;    // table de reaffichage 
   Sint32 briqueSave;            // pointeur sur "bricks_redraw"
 
diff -Naur tecnoballz-no-garbage/include/controller_sides_bricks.h tecnoballz-move-inverted/include/controller_sides_bricks.h
--- tecnoballz-no-garbage/include/controller_sides_bricks.h	2009-01-02 04:16:05.000000000 +0100
+++ tecnoballz-move-inverted/include/controller_sides_bricks.h	2009-01-03 16:51:54.000000000 +0100
@@ -126,9 +126,9 @@
         /** Index of the side brick from 0 to 11 */
         Uint32 side_brick_index;
       }
-    restaure_struct;
+    restore_struct;
     /** Structures used for restore background under sides bricks */
-    restaure_struct *restore_background;
+    restore_struct *restore_background;
     /** Index to save the next brick */
     Uint32 restore_save_index;
     /** Index to save the current brick */
diff -Naur tecnoballz-no-garbage/include/handler_keyboard.h tecnoballz-move-inverted/include/handler_keyboard.h
--- tecnoballz-no-garbage/include/handler_keyboard.h	2009-01-02 04:16:05.000000000 +0100
+++ tecnoballz-move-inverted/include/handler_keyboard.h	2009-01-03 16:51:54.000000000 +0100
@@ -161,8 +161,6 @@
 
     Sint32 mouse_x_offset;
     Sint32 mouse_y_offset;
-    Sint32 previous_mouse_x_coord;
-    Sint32 previous_mouse_y_coord;
 
     /* x and y coordinates of the mouse pointer */
     Sint32 mouse_x_coord;
@@ -208,6 +206,7 @@
     bool is_left_button_up (Sint32 * off_x, Sint32 * off_y);
     bool is_right_button_up (Sint32 * off_x, Sint32 * off_y);
     Sint32 get_mouse_x_offset ();
+    Sint32 get_mouse_y_offset ();
     Sint32 get_mouse_x ();
     Sint32 get_mouse_y ();
     bool key_is_pressed (Sint32 code);
diff -Naur tecnoballz-no-garbage/include/handler_levels.h tecnoballz-move-inverted/include/handler_levels.h
--- tecnoballz-no-garbage/include/handler_levels.h	2009-01-02 04:16:05.000000000 +0100
+++ tecnoballz-move-inverted/include/handler_levels.h	2009-01-03 16:51:54.000000000 +0100
@@ -161,7 +161,7 @@
     TiXmlDocument * xml_levels;
     guardians_level_desc *guardians_levels;
     bricks_level_desc *bricks_levels;
-    capsules_struct *caspsules_list;
+    capsules_struct *capsules_list;
     level_desc *levels_list;
   };
 #endif
diff -Naur tecnoballz-no-garbage/include/objects_list.h tecnoballz-move-inverted/include/objects_list.h
--- tecnoballz-no-garbage/include/objects_list.h	2009-01-02 04:16:05.000000000 +0100
+++ tecnoballz-move-inverted/include/objects_list.h	2009-01-03 16:51:54.000000000 +0100
@@ -47,7 +47,7 @@
 
   public:
     objects_list ();
-    ~objects_list ();
+    virtual ~objects_list ();
     static T * get_instance ();
     void littleInit ();
     void release_sprites_list ();
@@ -87,7 +87,7 @@
     {
       singleton = new T ();
     }
-  return (static_cast< T*> (singleton));
+  return singleton;
 }
 
 /**
diff -Naur tecnoballz-no-garbage/include/tecnoballz.h tecnoballz-move-inverted/include/tecnoballz.h
--- tecnoballz-no-garbage/include/tecnoballz.h	2009-01-02 04:16:05.000000000 +0100
+++ tecnoballz-move-inverted/include/tecnoballz.h	2009-01-03 16:51:54.000000000 +0100
@@ -204,8 +204,8 @@
   static void game_begin ();
   static void release_all_objects (configfile * pConf);
   static void integer_to_ascii (Sint32 value, Uint32 padding, char *str); 
-    tecnoballz ();
-   ~tecnoballz ();
+  tecnoballz ();
+  virtual ~tecnoballz ();
   void object_init ();
   void object_free ();
   void int_to_big_endian (Uint32 *, Uint32 *);
diff -Naur tecnoballz-no-garbage/src/controller_bricks.cc tecnoballz-move-inverted/src/controller_bricks.cc
--- tecnoballz-no-garbage/src/controller_bricks.cc	2009-01-02 04:16:05.000000000 +0100
+++ tecnoballz-move-inverted/src/controller_bricks.cc	2009-01-03 17:01:15.000000000 +0100
@@ -61,10 +61,10 @@
   brick_size = brick_width * brick_height;
   brkyoffset = BRKYOFFSET * resolution;
   indestructible_offset = 8 * brick_height * bricks_height;
-  ombre_deca = 3 * resolution;
-  ombre_left = (BRICK_HEIGHT * resolution) - ombre_deca;
-  ombre_yoff = (BRKYOFFSET - BRICK_HEIGHT) * resolution;
-  ombre_top1 = ombre_deca - ombre_yoff;
+  shadow_offset = 3 * resolution;
+  shadow_left = (BRICK_HEIGHT * resolution) - shadow_offset;
+  shadow_yoff = (BRKYOFFSET - BRICK_HEIGHT) * resolution;
+  shadow_top1 = shadow_offset - shadow_yoff;
   cycling_count = 0;
   is_cycling = true;
   were_sprites_added = false;
@@ -411,11 +411,11 @@
       return;
     }
   brick_info *map = bricks_map;
-  Sint32 xmax = MAX_OF_BRICKS_HORIZONTALLY * brick_width - ombre_deca;
-  for (Uint32 j = ombre_deca; j < MAX_OF_BRICKS_VERTICALLY * brkyoffset + ombre_deca;
+  Sint32 xmax = MAX_OF_BRICKS_HORIZONTALLY * brick_width - shadow_offset;
+  for (Uint32 j = shadow_offset; j < MAX_OF_BRICKS_VERTICALLY * brkyoffset + shadow_offset;
        j += brkyoffset)
     {
-      for (Sint32 i = -ombre_deca; i < xmax; i += brick_width)
+      for (Sint32 i = -shadow_offset; i < xmax; i += brick_width)
         {
           if (map->source_offset)
             {
@@ -695,7 +695,7 @@
     }
 
   /**
-   * restaure background
+   * restore background
    */
   Sint32 line2 = offsDestin;
   Sint32 * desP1 = adr_desti1;
@@ -725,33 +725,33 @@
   if ((map + offBri_BB)->is_displayed)
     {
       /* there is a bottom brick (2 lines to clear) */
-      j = ombre_yoff;
+      j = shadow_yoff;
     }
   else
     {
       /* there is not bottom brick: (6 lines to clear) */
-      j = ombre_deca;
+      j = shadow_offset;
     }
   Sint32
-    decal = display->ecran_next (adres, 0, brick_height);
-  display->clr_shadow (decal, brick_width - ombre_deca, j);
+    offset = display->ecran_next (adres, 0, brick_height);
+  display->clr_shadow (offset, brick_width - shadow_offset, j);
   /* left-bottom */
   if ((map + offBri_BG)->is_displayed)
     {
-      j = ombre_yoff;
+      j = shadow_yoff;
     }
   else
     {
-      j = ombre_deca;
+      j = shadow_offset;
     }
-  decal = display->ecran_next (adres, -ombre_deca, brick_height);
-  display->clr_shadow (decal, ombre_deca, j);
+  offset = display->ecran_next (adres, -shadow_offset, brick_height);
+  display->clr_shadow (offset, shadow_offset, j);
 
   /* left */
   if (!(map + offBri_GG)->is_displayed)
     {
-      decal = display->ecran_next (adres, -ombre_deca, ombre_deca);
-      display->clr_shadow (decal, ombre_deca, ombre_left);
+      offset = display->ecran_next (adres, -shadow_offset, shadow_offset);
+      display->clr_shadow (offset, shadow_offset, shadow_left);
     }
 
    /*
@@ -760,22 +760,22 @@
   /* exists a top brick? */
   if ((map + offBri_HH)->is_displayed)
     {
-      display->set_shadow (adres, brick_width - ombre_deca, ombre_top1);
+      display->set_shadow (adres, brick_width - shadow_offset, shadow_top1);
     }
 
   /* exists a right-top brick? */
   if ((map + offBri_HD)->is_displayed)
     {
-      decal = display->ecran_next (adres, brick_width - ombre_deca, 0);
-      display->set_shadow (decal, ombre_deca, ombre_top1);
+      offset = display->ecran_next (adres, brick_width - shadow_offset, 0);
+      display->set_shadow (offset, shadow_offset, shadow_top1);
     }
 
   /* exists a right-top brick? */
   if ((map + offBri_DD)->is_displayed)
     {
-      decal =
-        display->ecran_next (adres, brick_width - ombre_deca, ombre_deca);
-      display->set_shadow (decal, ombre_deca, ombre_left);
+      offset =
+        display->ecran_next (adres, brick_width - shadow_offset, shadow_offset);
+      display->set_shadow (offset, shadow_offset, shadow_left);
     }
 
   return true;
diff -Naur tecnoballz-no-garbage/src/controller_capsules.cc tecnoballz-move-inverted/src/controller_capsules.cc
--- tecnoballz-no-garbage/src/controller_capsules.cc	2009-01-02 04:16:04.000000000 +0100
+++ tecnoballz-move-inverted/src/controller_capsules.cc	2009-01-03 16:51:53.000000000 +0100
@@ -113,7 +113,7 @@
 
 /**
  * Check if send a bonus or penalty capsule from brick
- * @param brick Pointer to the brick which touched by a ball
+ * @param brick Pointer to the brick touched by a ball
  */
 void
 controller_capsules::send_capsule_from_brick (brick_redraw * brick)
@@ -139,7 +139,7 @@
         }
 
       /*
-       * Send a bonus capsule bought in th shop
+       * Send a bonus capsule bought in the shop
        */
       if (num_of_caspules_bought > capsules_released_count
           && bricks_breaked_count > bonus_delay)
diff -Naur tecnoballz-no-garbage/src/controller_sides_bricks.cc tecnoballz-move-inverted/src/controller_sides_bricks.cc
--- tecnoballz-no-garbage/src/controller_sides_bricks.cc	2009-01-02 04:16:04.000000000 +0100
+++ tecnoballz-move-inverted/src/controller_sides_bricks.cc	2009-01-03 16:51:53.000000000 +0100
@@ -61,7 +61,7 @@
   background_top_side = NULL;
   background_right_side = NULL;
   background_left_side = NULL;
-  restore_background = (restaure_struct *) NULL;
+  restore_background = (restore_struct *) NULL;
   restore_save_index = 0;
   restore_index = 0;
   for (Uint32 i = 0; i < MAX_OF_SIDES_BRICKS; i++)
@@ -239,7 +239,7 @@
   /* allocate memory for background restoration under sides bricks */
   try
     {
-      restore_background = new restaure_struct[MAX_OF_RESTORED_BRICKS];
+      restore_background = new restore_struct[MAX_OF_RESTORED_BRICKS];
     }
   catch (std::bad_alloc &)
     {
diff -Naur tecnoballz-no-garbage/src/handler_audio.cc tecnoballz-move-inverted/src/handler_audio.cc
--- tecnoballz-no-garbage/src/handler_audio.cc	2009-01-02 04:16:04.000000000 +0100
+++ tecnoballz-move-inverted/src/handler_audio.cc	2009-01-03 16:51:53.000000000 +0100
@@ -234,7 +234,7 @@
       "Mix_QuerySpec return " << Mix_GetError () << std::endl;
       return;
     }
-  char *format = "Unknown";
+  const char *format = "Unknown";
   switch (format_id)
     {
     case AUDIO_U8:
diff -Naur tecnoballz-no-garbage/src/handler_keyboard.cc tecnoballz-move-inverted/src/handler_keyboard.cc
--- tecnoballz-no-garbage/src/handler_keyboard.cc	2009-01-02 04:16:04.000000000 +0100
+++ tecnoballz-move-inverted/src/handler_keyboard.cc	2009-01-03 16:51:53.000000000 +0100
@@ -64,8 +64,6 @@
 {
   object_init ();
   is_grab_input = false;
-  previous_mouse_x_coord = 0;
-  previous_mouse_y_coord = 0;
   mouse_x_offset = 0;
   mouse_y_offset = 0;
   /* x and y coordinates of the mouse */
@@ -564,6 +562,8 @@
           /* read the x and y coordinates of the mouse */
           mouse_x_coord = event.motion.x;
           mouse_y_coord = event.motion.y;
+          mouse_x_offset += event.motion.xrel;
+          mouse_y_offset += event.motion.yrel;
         }
         break;
 
@@ -1029,8 +1029,8 @@
     {
       SDL_WM_GrabInput (SDL_GRAB_ON);
     }
-  previous_mouse_x_coord = mouse_x_coord;
-  previous_mouse_y_coord = mouse_y_coord;
+  mouse_x_offset = 0;
+  mouse_y_offset = 0;
   is_key_waiting = true;
   wait_key_pressed = false;
 }
@@ -1142,13 +1142,25 @@
 Sint32
 handler_keyboard::get_mouse_x_offset ()
 {
-  mouse_x_offset = mouse_x_coord - previous_mouse_x_coord;
-  mouse_y_offset = mouse_y_coord - previous_mouse_y_coord;
-  previous_mouse_x_coord = mouse_x_coord;
-  previous_mouse_y_coord = mouse_y_coord;
-  random_counter += previous_mouse_x_coord;
-  random_counter += previous_mouse_y_coord;
-  return mouse_x_offset;
+  Sint32 retval = mouse_x_offset;
+  random_counter += mouse_x_coord + mouse_x_offset;
+  mouse_x_offset = 0;
+
+  return retval;
+}
+
+/**
+ * Caculate and return offset of vertical displacement of the mouse
+ * @return the mouse vertical offset
+ */
+Sint32
+handler_keyboard::get_mouse_y_offset ()
+{
+  Sint32 retval = mouse_y_offset;
+  random_counter += mouse_y_coord + mouse_y_offset;
+  mouse_y_offset = 0;
+
+  return retval;
 }
 
 /**
diff -Naur tecnoballz-no-garbage/src/handler_levels.cc tecnoballz-move-inverted/src/handler_levels.cc
--- tecnoballz-no-garbage/src/handler_levels.cc	2009-01-02 04:16:04.000000000 +0100
+++ tecnoballz-move-inverted/src/handler_levels.cc	2009-01-03 16:51:53.000000000 +0100
@@ -44,7 +44,7 @@
   levels_list = NULL;
   bricks_levels = NULL;
   guardians_levels = NULL;
-  caspsules_list = NULL;
+  capsules_list = NULL;
   levels_counter = 0;
   bricks_levels_counter = 0;
   guardians_levels_counter = 0;
@@ -80,7 +80,7 @@
   {
     bricks_levels = new bricks_level_desc[bricks_levels_counter];
     guardians_levels = new guardians_level_desc[guardians_levels_counter];
-    caspsules_list = new capsules_struct[capsules_lists_counter];
+    capsules_list = new capsules_struct[capsules_lists_counter];
     levels_list = new level_desc[levels_counter];
   }
   catch (bad_alloc &)
@@ -316,13 +316,13 @@
         case CAPSULES_NODE:
           if (last_element == "identifier")
             {
-              caspsules_list[capsule_list_index].id = value;
+              capsules_list[capsule_list_index].id = value;
             }
           if (last_element == "id")
             {
               /* collect all the codes caspules */
               capsule_index++;
-              caspsules_list[capsule_list_index].codes[capsule_index] = value;
+              capsules_list[capsule_list_index].codes[capsule_index] = value;
             }
           break;
         case BRICKS_LEVEL_NODE:
@@ -378,7 +378,7 @@
           if (last_element == "penalties_list_id")
             {
               bricks_levels[bricks_level_index].malusListe =
-                get_capsules_list (value);;
+                get_capsules_list (value);
             }
           if (last_element == "starting_speed")
             {
@@ -516,7 +516,7 @@
 {
   for (Uint32 i = 0; i < capsules_lists_counter; i++)
     {
-      capsules_struct *capsule = &caspsules_list[i];
+      capsules_struct *capsule = &capsules_list[i];
       if (capsule->id == id)
         {
           return &capsule->codes[0];
@@ -544,10 +544,10 @@
       delete[]bricks_levels;
       bricks_levels = NULL;
     }
-  if (NULL != caspsules_list)
+  if (NULL != capsules_list)
     {
-      delete[]caspsules_list;
-      caspsules_list = NULL;
+      delete[]capsules_list;
+      capsules_list = NULL;
     }
   if (NULL != guardians_levels)
     {
diff -Naur tecnoballz-no-garbage/src/supervisor_map_editor.cc tecnoballz-move-inverted/src/supervisor_map_editor.cc
--- tecnoballz-no-garbage/src/supervisor_map_editor.cc	2009-01-02 04:16:04.000000000 +0100
+++ tecnoballz-move-inverted/src/supervisor_map_editor.cc	2009-01-03 16:51:53.000000000 +0100
@@ -832,7 +832,7 @@
 #else
   umask (0002);
 #endif
-  char *
+  const char *
   filename = "edmap.data";
   Sint32
   handle = open (filename, O_WRONLY | O_CREAT, 00666);

Reply via email to