gnome-games r7438 - trunk/gnobots2
- From: andreasr svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-games r7438 - trunk/gnobots2
- Date: Sat, 1 Mar 2008 18:46:37 +0000 (GMT)
Author: andreasr
Date: Sat Mar 1 18:46:36 2008
New Revision: 7438
URL: http://svn.gnome.org/viewvc/gnome-games?rev=7438&view=rev
Log:
Fix a bug where an annoying blank rectangle is left after a robot splat. Patch by Fernando Martins in bug #506162.
Modified:
trunk/gnobots2/ChangeLog
trunk/gnobots2/game.c
trunk/gnobots2/graphics.c
Modified: trunk/gnobots2/game.c
==============================================================================
--- trunk/gnobots2/game.c (original)
+++ trunk/gnobots2/game.c Sat Mar 1 18:46:36 2008
@@ -535,7 +535,7 @@
if (arena[i][j] == OBJECT_ROBOT1) {
num_robots1 += 1;
} else if (arena[i][j] == OBJECT_ROBOT2) {
- num_robots2 += 2;
+ num_robots2 += 1;
}
}
}
Modified: trunk/gnobots2/graphics.c
==============================================================================
--- trunk/gnobots2/graphics.c (original)
+++ trunk/gnobots2/graphics.c Sat Mar 1 18:46:36 2008
@@ -446,11 +446,35 @@
static void
clear_bubble_area (void)
{
+ int t0i, t0j; /* (i,j) coordinates of bubble's top/left tile */
+ int ntiles_hor, ntiles_ver; /* number of tiles hotizontal/vertically affected */
+ int delta; /* pixels from tile's left/top border to bubble's left/top border */
+ int i, j;
+
if (game_area == NULL)
return;
- gdk_window_clear_area (game_area->window, bubble_xpos, bubble_ypos,
- BUBBLE_WIDTH, BUBBLE_HEIGHT);
+ t0i = bubble_xpos / tile_width;
+ t0j = bubble_ypos / tile_height;
+ ntiles_hor = (BUBBLE_WIDTH + tile_width - 1) / tile_width; /* first shot at number of tiles affected */
+ delta = bubble_xpos % tile_width;
+ if (delta > 0) { /* buble does not start at a tile's left boundary */
+ if ((BUBBLE_WIDTH + delta) > ntiles_hor * tile_width) { /* catches an extra tile */
+ ntiles_hor++;
+ }
+ }
+ ntiles_ver = (BUBBLE_HEIGHT + tile_height - 1) / tile_height;
+ delta = bubble_ypos % tile_height;
+ if (delta > 0) { /* buble does not start at a tile's top boundary */
+ if ((BUBBLE_HEIGHT + delta) > ntiles_ver * tile_height) { /* catches an extra tile */
+ ntiles_ver++;
+ }
+ }
+ for (i = t0i; i < t0i + ntiles_hor; ++i) {
+ for (j = t0j; j < t0j + ntiles_ver; ++j) {
+ draw_tile_pixmap (-1, i, j, game_area);
+ }
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]