diff options
author | joerg <joerg@pkgsrc.org> | 2012-07-03 18:43:37 +0000 |
---|---|---|
committer | joerg <joerg@pkgsrc.org> | 2012-07-03 18:43:37 +0000 |
commit | 244c7981add63c0330487e7dd9efd978ed18e08f (patch) | |
tree | 3ee4478e4771fefd9c920ddb0852a7ec6c3e8ad6 /games | |
parent | f82042d05955df3622757d47f97a3959de14df99 (diff) | |
download | pkgsrc-244c7981add63c0330487e7dd9efd978ed18e08f.tar.gz |
Remove use of nested functions
Diffstat (limited to 'games')
-rw-r--r-- | games/frozen-bubble/Makefile | 3 | ||||
-rw-r--r-- | games/frozen-bubble/distinfo | 3 | ||||
-rw-r--r-- | games/frozen-bubble/patches/patch-c__stuff_fb__c__stuff.xs | 81 |
3 files changed, 85 insertions, 2 deletions
diff --git a/games/frozen-bubble/Makefile b/games/frozen-bubble/Makefile index c330551ef71..1cec5e12cfb 100644 --- a/games/frozen-bubble/Makefile +++ b/games/frozen-bubble/Makefile @@ -1,7 +1,8 @@ -# $NetBSD: Makefile,v 1.33 2012/03/04 22:27:07 wiz Exp $ +# $NetBSD: Makefile,v 1.34 2012/07/03 18:43:37 joerg Exp $ # DISTNAME= frozen-bubble-2.2.0 +PKGREVISION= 1 CATEGORIES= games MASTER_SITES= http://www.frozen-bubble.org/data/ EXTRACT_SUFX= .tar.bz2 diff --git a/games/frozen-bubble/distinfo b/games/frozen-bubble/distinfo index 6d5c334ca6c..f7185783b49 100644 --- a/games/frozen-bubble/distinfo +++ b/games/frozen-bubble/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.6 2012/03/04 22:27:08 wiz Exp $ +$NetBSD: distinfo,v 1.7 2012/07/03 18:43:37 joerg Exp $ SHA1 (frozen-bubble-2.2.0.tar.bz2) = df5a8c839a76fd662777925b2eb80fcb8adf3fa6 RMD160 (frozen-bubble-2.2.0.tar.bz2) = 1bbe0163c28421c497979c85a98f64a98174c780 @@ -6,3 +6,4 @@ Size (frozen-bubble-2.2.0.tar.bz2) = 20585572 bytes SHA1 (patch-aa) = ba588d24ab8cac1a96cc17ca04bbc259e6dc369b SHA1 (patch-ab) = c39aa9be7566305116f4f5209409daee69e828a8 SHA1 (patch-ac) = 111db5d2a5e8f7463bc7b4457d0a76303afbda54 +SHA1 (patch-c__stuff_fb__c__stuff.xs) = 96f5bbf4790ad9663b84dc6165f88323bf3b5cfd diff --git a/games/frozen-bubble/patches/patch-c__stuff_fb__c__stuff.xs b/games/frozen-bubble/patches/patch-c__stuff_fb__c__stuff.xs new file mode 100644 index 00000000000..db6e2f0a284 --- /dev/null +++ b/games/frozen-bubble/patches/patch-c__stuff_fb__c__stuff.xs @@ -0,0 +1,81 @@ +$NetBSD: patch-c__stuff_fb__c__stuff.xs,v 1.1 2012/07/03 18:43:37 joerg Exp $ + +--- c_stuff/fb_c_stuff.xs.orig 2012-07-03 14:35:36.000000000 +0000 ++++ c_stuff/fb_c_stuff.xs +@@ -96,14 +96,12 @@ int rand_(double val) { return 1+(int) ( + + void store_effect(SDL_Surface * s, SDL_Surface * img) + { +- void copy_line(int l) { +- memcpy(s->pixels + l*img->pitch, img->pixels + l*img->pitch, img->pitch); +- } +- void copy_column(int c) { +- int bpp = img->format->BytesPerPixel; +- for (y=0; y<YRES; y++) +- memcpy(s->pixels + y*img->pitch + c*bpp, img->pixels + y*img->pitch + c*bpp, bpp); +- } ++#define copy_line(l) memcpy(s->pixels + l*img->pitch, img->pixels + l*img->pitch, img->pitch) ++#define copy_column(c) do { \ ++ int bpp = img->format->BytesPerPixel; \ ++ for (y=0; y<YRES; y++) \ ++ memcpy(s->pixels + y*img->pitch + c*bpp, img->pixels + y*img->pitch + c*bpp, bpp); \ ++ } while (0) + + int step = 0; + int store_thickness = 15; +@@ -181,15 +179,8 @@ void squares_effect(SDL_Surface * s, SDL + int bpp = img->format->BytesPerPixel; + const int squares_size = 32; + +- int fillrect(int i, int j) { +- int c, v; +- if (i >= XRES/squares_size || j >= YRES/squares_size) +- return 0; +- v = i*squares_size*bpp + j*squares_size*img->pitch; +- for (c=0; c<squares_size; c++) +- memcpy(s->pixels + v + c*img->pitch, img->pixels + v + c*img->pitch, squares_size*bpp); +- return 1; +- } ++#define fillrect(i, j) \ ++ } while (0) + + int still_moving = 1; + +@@ -200,8 +191,13 @@ void squares_effect(SDL_Surface * s, SDL + + still_moving = 0; + for (j=i; j>=0; j--) { +- if (fillrect(j, k)) +- still_moving = 1; ++ if (i >= XRES/squares_size || j >= YRES/squares_size) ++ continue; ++ int c, v; ++ v = i*squares_size*bpp + j*squares_size*img->pitch; ++ for (c=0; c<squares_size; c++) ++ memcpy(s->pixels + v + c*img->pitch, img->pixels + v + c*img->pitch, squares_size*bpp); ++ still_moving = 1; + k++; + } + +@@ -211,12 +207,12 @@ void squares_effect(SDL_Surface * s, SDL + + + /* -------------- Circle ------------------ */ ++#define sqr(v) ((v) * (v)) + + int * circle_steps; + const int circle_max_steps = 40; + void circle_init(void) + { +- int sqr(int v) { return v*v; } + + circle_steps = malloc(XRES * YRES * sizeof(int)); + if (!circle_steps) +@@ -229,6 +225,7 @@ void circle_init(void) + circle_steps[x+y*XRES] = (max-value)*circle_max_steps/max; + } + } ++#undef sqr + + void circle_effect(SDL_Surface * s, SDL_Surface * img) + { |