X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=hacks%2Fmountain.c;h=541b18735beb798da4da25c08594b219e2521f27;hb=39809ded547bdbb08207d3e514950425215b4410;hp=6b2378891cac7b2951f60623bba66019b45c86f3;hpb=a94197e76a5dea5cb60542840809d6c20d0abbf3;p=xscreensaver diff --git a/hacks/mountain.c b/hacks/mountain.c index 6b237889..541b1873 100644 --- a/hacks/mountain.c +++ b/hacks/mountain.c @@ -1,9 +1,8 @@ /* -*- Mode: C; tab-width: 4 -*- */ /* mountain -- square grid mountains */ -#if !defined( lint ) && !defined( SABER ) +#if 0 static const char sccsid[] = "@(#)mountain.c 5.00 2000/11/01 xlockmore"; - #endif /*- @@ -28,30 +27,31 @@ static const char sccsid[] = "@(#)mountain.c 5.00 2000/11/01 xlockmore"; */ #ifdef STANDALONE -#define MODE_mountain -#define PROGCLASS "Mountain" -#define HACK_INIT init_mountain -#define HACK_DRAW draw_mountain -#define mountain_opts xlockmore_opts -#define DEFAULTS "*delay: 1000 \n" \ - "*count: 30 \n" \ - "*cycles: 4000 \n" \ - "*ncolors: 64 \n" -#define SMOOTH_COLORS -#include "xlockmore.h" /* in xscreensaver distribution */ +# define MODE_mountain +#define DEFAULTS "*delay: 20000 \n" \ + "*count: 30 \n" \ + "*cycles: 4000 \n" \ + "*ncolors: 64 \n" \ + "*fpsSolid: true \n" \ + +# define SMOOTH_COLORS +# define release_mountain 0 +# define reshape_mountain 0 +# define mountain_handle_event 0 +# include "xlockmore.h" /* in xscreensaver distribution */ #else /* STANDALONE */ -#include "xlock.h" /* in xlockmore distribution */ +# include "xlock.h" /* in xlockmore distribution */ #endif /* STANDALONE */ #ifdef MODE_mountain -ModeSpecOpt mountain_opts = +ENTRYPOINT ModeSpecOpt mountain_opts = {0, (XrmOptionDescRec *) NULL, 0, (argtype *) NULL, (OptionStruct *) NULL}; #ifdef USE_MODULES ModStruct mountain_description = -{"mountain", "init_mountain", "draw_mountain", "release_mountain", - "refresh_mountain", "init_mountain", (char *) NULL, &mountain_opts, +{"mountain", "init_mountain", "draw_mountain", (char *) NULL, + "refresh_mountain", "init_mountain", "free_mountain", &mountain_opts, 1000, 30, 4000, 1, 64, 1.0, "", "Shows Papo's mountain range", 0, NULL}; @@ -164,18 +164,14 @@ drawamountain(ModeInfo * mi) mp->stage++; } -void -init_mountain(ModeInfo * mi) +ENTRYPOINT void +init_mountain (ModeInfo * mi) { int i, j, x, y; XGCValues gcv; mountainstruct *mp; - if (mountains == NULL) { - if ((mountains = (mountainstruct *) calloc(MI_NUM_SCREENS(mi), - sizeof (mountainstruct))) == NULL) - return; - } + MI_INIT (mi, mountains); mp = &mountains[MI_SCREEN(mi)]; mp->width = MI_WIDTH(mi); @@ -229,8 +225,8 @@ init_mountain(ModeInfo * mi) mp->offset = 0; } -void -draw_mountain(ModeInfo * mi) +ENTRYPOINT void +draw_mountain (ModeInfo * mi) { mountainstruct *mp; @@ -256,24 +252,17 @@ draw_mountain(ModeInfo * mi) } } -void -release_mountain(ModeInfo * mi) +ENTRYPOINT void +free_mountain (ModeInfo * mi) { - if (mountains != NULL) { - int screen; - - for (screen = 0; screen < MI_NUM_SCREENS(mi); screen++) { - mountainstruct *mp = &mountains[screen]; + mountainstruct *mp = &mountains[MI_SCREEN(mi)]; - if (mp->stippledGC) - XFreeGC(MI_DISPLAY(mi), mp->stippledGC); - } - (void) free((void *) mountains); - mountains = (mountainstruct *) NULL; - } + if (mp->stippledGC) + XFreeGC(MI_DISPLAY(mi), mp->stippledGC); } -void +#ifndef STANDALONE +ENTRYPOINT void refresh_mountain(ModeInfo * mi) { mountainstruct *mp; @@ -286,5 +275,8 @@ refresh_mountain(ModeInfo * mi) mp->x = 0; mp->y = 0; } +#endif + +XSCREENSAVER_MODULE ("Mountain", mountain) #endif /* MODE_mountain */