X-Git-Url: http://git.hungrycats.org/cgi-bin/gitweb.cgi?p=xscreensaver;a=blobdiff_plain;f=hacks%2Fglx%2Fglsnake.c;h=534788b4c3d28601d5efaed223c004ed98357390;hp=dd533539f41e0b06c4142465aa6badb9025dd794;hb=ffd8c0873576a9e3065696a624dce6b766b77062;hpb=96a411663168b0ba5432b407a83be55f3df0c802 diff --git a/hacks/glx/glsnake.c b/hacks/glx/glsnake.c index dd533539..534788b4 100644 --- a/hacks/glx/glsnake.c +++ b/hacks/glx/glsnake.c @@ -36,7 +36,6 @@ #include #include #include -#include /* angles */ #define ZERO 0.0 @@ -165,27 +164,27 @@ static XrmOptionDescRec opts[] = { { "-statictime", ".statictime", XrmoptionSepArg, DEF_STATICTIME }, { "-yangvel", ".yangvel", XrmoptionSepArg, DEF_YANGVEL }, { "-zangvel", ".zangvel", XrmoptionSepArg, DEF_ZANGVEL }, - { "-altcolour", ".altcolour", XrmoptionNoArg, (caddr_t) "True" }, - { "-no-altcolour", ".altcolour", XrmoptionNoArg, (caddr_t) "False" }, - { "-titles", ".titles", XrmoptionNoArg, (caddr_t) "True" }, - { "-no-titles", ".titles", XrmoptionNoArg, (caddr_t) "False" }, + { "-altcolour", ".altcolour", XrmoptionNoArg, "True" }, + { "-no-altcolour", ".altcolour", XrmoptionNoArg, "False" }, + { "-titles", ".titles", XrmoptionNoArg, "True" }, + { "-no-titles", ".titles", XrmoptionNoArg, "False" }, { "-zoom", ".zoom", XrmoptionSepArg, DEF_ZOOM }, - { "-wireframe", ".wireframe", XrmoptionNoArg, (caddr_t) "true" }, - { "-no-wireframe", ".wireframe", XrmoptionNoArg, (caddr_t) "false" }, + { "-wireframe", ".wireframe", XrmoptionNoArg, "true" }, + { "-no-wireframe", ".wireframe", XrmoptionNoArg, "false" }, }; static argtype vars[] = { - {(caddr_t *) &explode, "explode", "Explode", DEF_EXPLODE, t_Float}, - {(caddr_t *) &angvel, "angvel", "Angular Velocity", DEF_ANGVEL, t_Float}, - {(caddr_t *) &accel, "accel", "Acceleration", DEF_ACCEL, t_Float}, - {(caddr_t *) &statictime, "statictime", "Static Time", DEF_STATICTIME, t_Int}, - {(caddr_t *) &yangvel, "yangvel", "Angular Velocity about Y axis", DEF_YANGVEL, t_Float}, - {(caddr_t *) &zangvel, "zangvel", "Angular Velocity about X axis", DEF_ZANGVEL, t_Float}, - {(caddr_t *) &interactive, "interactive", "Interactive", DEF_INTERACTIVE, t_Bool}, - {(caddr_t *) &altcolour, "altcolour", "Alternate Colour Scheme", DEF_ALTCOLOUR, t_Bool}, - {(caddr_t *) &titles, "titles", "Titles", DEF_TITLES, t_Bool}, - {(caddr_t *) &zoom, "zoom", "Zoom", DEF_ZOOM, t_Float}, - {(caddr_t *) &wireframe, "wireframe", "Wireframe", DEF_WIREFRAME, t_Bool}, + {&explode, "explode", "Explode", DEF_EXPLODE, t_Float}, + {&angvel, "angvel", "Angular Velocity", DEF_ANGVEL, t_Float}, + {&accel, "accel", "Acceleration", DEF_ACCEL, t_Float}, + {&statictime, "statictime", "Static Time", DEF_STATICTIME, t_Int}, + {&yangvel, "yangvel", "Angular Velocity about Y axis", DEF_YANGVEL, t_Float}, + {&zangvel, "zangvel", "Angular Velocity about X axis", DEF_ZANGVEL, t_Float}, + {&interactive, "interactive", "Interactive", DEF_INTERACTIVE, t_Bool}, + {&altcolour, "altcolour", "Alternate Colour Scheme", DEF_ALTCOLOUR, t_Bool}, + {&titles, "titles", "Titles", DEF_TITLES, t_Bool}, + {&zoom, "zoom", "Zoom", DEF_ZOOM, t_Float}, + {&wireframe, "wireframe", "Wireframe", DEF_WIREFRAME, t_Bool}, }; ModeSpecOpt sws_opts = {countof(opts), opts, countof(vars), vars, NULL}; @@ -1849,6 +1848,11 @@ float morph_percent(void) { /* ang_diff / rot approaches 0, we want the complement */ retval = 1.0 - (ang_diff_max / rot_max); /* protect against naan */ + +/* Apparently some systems (Solaris) don't have isinf() */ +#undef isinf +#define isinf(x) (((x) > 999999999999.9) || ((x) < -999999999999.9)) + if (isnan(retval) || isinf(retval)) retval = 1.0; } /*printf("morph_pct = %f\n", retval);*/