Update a cherry-picked patch from ustream svn to finally fix nicely
https://gna.org/bugs/?11751 ok ajacoutot@
This commit is contained in:
parent
1c10b87871
commit
baf2d01a74
@ -1,9 +1,9 @@
|
||||
# $OpenBSD: Makefile,v 1.6 2008/05/30 11:40:24 landry Exp $
|
||||
# $OpenBSD: Makefile,v 1.7 2008/06/08 16:10:40 landry Exp $
|
||||
|
||||
COMMENT= free software clone of Worms(R) game concept
|
||||
|
||||
DISTNAME= wormux-0.8
|
||||
PKGNAME= ${DISTNAME}p0
|
||||
PKGNAME= ${DISTNAME}p1
|
||||
CATEGORIES= games
|
||||
|
||||
HOMEPAGE= http://wormux.org
|
||||
|
@ -1,29 +1,73 @@
|
||||
$OpenBSD: patch-src_map_tileitem_cpp,v 1.2 2008/05/28 18:44:32 landry Exp $
|
||||
--- src/map/tileitem.cpp.orig Fri May 16 00:47:34 2008
|
||||
+++ src/map/tileitem.cpp Wed May 21 14:36:51 2008
|
||||
@@ -139,15 +139,14 @@ void TileItem_AlphaSoftware::Dig(const Point2i ¢er
|
||||
while ( (uint) y <= center.y + radius + EXPLOSION_BORDER_SIZE&& y < CELL_SIZE.y )
|
||||
$OpenBSD: patch-src_map_tileitem_cpp,v 1.3 2008/06/08 16:10:40 landry Exp $
|
||||
--- src/map/tileitem.cpp.orig Thu May 15 16:47:34 2008
|
||||
+++ src/map/tileitem.cpp Sat Jun 7 13:58:38 2008
|
||||
@@ -27,6 +27,7 @@
|
||||
#include "include/app.h"
|
||||
#include "map/camera.h"
|
||||
#include "tool/error.h"
|
||||
+#include "tool/math_tools.h"
|
||||
#include "tool/point.h"
|
||||
//#include "tool/stats.h"
|
||||
#ifdef DBG_TILE
|
||||
@@ -132,44 +133,36 @@ void TileItem_AlphaSoftware::Dig(const Point2i ¢er
|
||||
const uint line_size = m_surface.GetPitch();
|
||||
const uint bpp = m_surface.GetBytesPerPixel();
|
||||
|
||||
- int y = (center.y - (int)radius - (int)EXPLOSION_BORDER_SIZE >= 0) ? (center.y - (int)radius - EXPLOSION_BORDER_SIZE) : 0;
|
||||
+ int y = center.y - (int)(radius+EXPLOSION_BORDER_SIZE);
|
||||
+ if (y < 0) y = 0;
|
||||
buf += y * line_size;
|
||||
|
||||
//Empties each line of the tile horizontaly that are in the circle
|
||||
- while ( (uint) y <= center.y + radius + EXPLOSION_BORDER_SIZE&& y < CELL_SIZE.y )
|
||||
+ for (; (uint)y <= center.y + radius + EXPLOSION_BORDER_SIZE && y < CELL_SIZE.y;
|
||||
+ buf += line_size, y++)
|
||||
{
|
||||
//Abscisse distance from the center of the circle to the circle
|
||||
- int dac = center.y - y;
|
||||
+ int dac = y - center.y;
|
||||
int dac = center.y - y;
|
||||
|
||||
//Angle on the circle
|
||||
- //Angle on the circle
|
||||
- float angle = asin( (float)dac / (float)radius);
|
||||
+ float angle = asin( (float)dac / (float)(radius + EXPLOSION_BORDER_SIZE));
|
||||
+ //Darken the border of the removed ground
|
||||
+ int blength = lround(sqrt((radius+EXPLOSION_BORDER_SIZE)*(radius+EXPLOSION_BORDER_SIZE) - dac*dac));
|
||||
|
||||
+ //Nothing to empty, just darken
|
||||
+ if ((uint)abs(dac) > radius) {
|
||||
+ Darken(center.x-blength, center.x+blength, buf, bpp);
|
||||
+ continue;
|
||||
+ }
|
||||
+
|
||||
//Zone of the line which needs to be emptied
|
||||
int start_x, end_x, lenght;
|
||||
lenght = (int) ((float) radius * cos (angle));
|
||||
- int start_x, end_x, lenght;
|
||||
- lenght = (int) ((float) radius * cos (angle));
|
||||
- lenght = lenght > 0 ? lenght : - lenght;
|
||||
start_x = center.x - lenght;
|
||||
lenght *= 2;
|
||||
end_x = start_x + lenght;
|
||||
@@ -158,7 +157,6 @@ void TileItem_AlphaSoftware::Dig(const Point2i ¢er
|
||||
int bstart_x, bend_x, blenght;
|
||||
angle = asin( (float)dac / (float)(radius + EXPLOSION_BORDER_SIZE));
|
||||
blenght = (int) ((float) (radius + EXPLOSION_BORDER_SIZE) * cos (angle));
|
||||
- start_x = center.x - lenght;
|
||||
- lenght *= 2;
|
||||
- end_x = start_x + lenght;
|
||||
- Empty(start_x, end_x, buf, bpp);
|
||||
+ int length = lround(sqrt(radius*radius - dac*dac));
|
||||
|
||||
- //Darken the border of the removed ground
|
||||
// Left half of the circle
|
||||
- int bstart_x, bend_x, blenght;
|
||||
- angle = asin( (float)dac / (float)(radius + EXPLOSION_BORDER_SIZE));
|
||||
- blenght = (int) ((float) (radius + EXPLOSION_BORDER_SIZE) * cos (angle));
|
||||
- blenght = blenght > 0 ? blenght : - blenght;
|
||||
bstart_x = center.x - blenght;
|
||||
bend_x = bstart_x + (blenght - lenght/2);
|
||||
Darken(bstart_x, bend_x, buf, bpp);
|
||||
- bstart_x = center.x - blenght;
|
||||
- bend_x = bstart_x + (blenght - lenght/2);
|
||||
- Darken(bstart_x, bend_x, buf, bpp);
|
||||
+ Darken(center.x-blength, center.x-length, buf, bpp);
|
||||
|
||||
- // Right half of the circle
|
||||
- bstart_x = center.x + lenght/2 + 1;
|
||||
- bend_x = bstart_x + (blenght - lenght/2);
|
||||
- Darken(bstart_x, bend_x, buf, bpp);
|
||||
+ // Rigth half of the circle
|
||||
+ Darken(center.x+length, center.x+blength, buf, bpp);
|
||||
|
||||
- buf += line_size;
|
||||
- y++;
|
||||
+ Empty(center.x-length, center.x+length, buf, bpp);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user