Adding "indent.sh" to re-indent code; ran it!!!

This commit is contained in:
Bill Kendrick 2023-04-23 23:26:00 -07:00
parent 16336cc854
commit 18f9cad6fe
98 changed files with 5798 additions and 9001 deletions

View file

@ -72,8 +72,7 @@ const int alien_groups[alien_NUM_TOOLS] = {
};
const char *alien_descs[alien_NUM_TOOLS][2] = {
{gettext_noop
("Click and drag the mouse to change the colors in parts of your picture."),
{gettext_noop("Click and drag the mouse to change the colors in parts of your picture."),
gettext_noop("Click to change the colors in your entire picture."),},
};
@ -86,12 +85,10 @@ char *alien_get_name(magic_api * api, int which);
int alien_get_group(magic_api * api, int which);
char *alien_get_description(magic_api * api, int which, int mode);
void alien_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y,
SDL_Rect * update_rect);
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect);
Mix_Chunk *magic_loadsound(char *file);
void alien_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, int x, int y,
SDL_Rect * update_rect);
SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
void alien_release(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
void alien_shutdown(magic_api * api);
@ -101,12 +98,9 @@ int alien_requires_colors(magic_api * api, int which);
Uint8 alien_accepted_sizes(magic_api * api, int which, int mode);
Uint8 alien_default_size(magic_api * api, int which, int mode);
void alien_set_size(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last,
Uint8 size, SDL_Rect * update_rect);
void alien_switchin(magic_api * api, int which, int mode,
SDL_Surface * canvas);
void alien_switchout(magic_api * api, int which, int mode,
SDL_Surface * canvas);
SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect);
void alien_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
void alien_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
int alien_modes(magic_api * api, int which);
@ -125,8 +119,7 @@ int alien_init(magic_api * api, Uint32 disabled_features ATTRIBUTE_UNUSED)
for (i = 0; i < alien_NUM_TOOLS; i++)
{
snprintf(fname, sizeof(fname), "%ssounds/magic/%s", api->data_directory,
alien_snd_filenames[i]);
snprintf(fname, sizeof(fname), "%ssounds/magic/%s", api->data_directory, alien_snd_filenames[i]);
alien_snd_effect[i] = Mix_LoadWAV(fname);
}
return (1);
@ -142,8 +135,7 @@ SDL_Surface *alien_get_icon(magic_api * api, int which)
{
char fname[1024];
snprintf(fname, sizeof(fname), "%simages/magic/%s", api->data_directory,
alien_icon_filenames[which]);
snprintf(fname, sizeof(fname), "%simages/magic/%s", api->data_directory, alien_icon_filenames[which]);
return (IMG_Load(fname));
}
@ -159,16 +151,14 @@ int alien_get_group(magic_api * api ATTRIBUTE_UNUSED, int which)
}
// Return our descriptions, localized:
char *alien_get_description(magic_api * api ATTRIBUTE_UNUSED, int which,
int mode)
char *alien_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode)
{
return (strdup(gettext_noop(alien_descs[which][mode - 1])));
}
//Do the effect for one pixel
static void do_alien_pixel(void *ptr, int which ATTRIBUTE_UNUSED,
SDL_Surface * canvas,
SDL_Surface * last ATTRIBUTE_UNUSED, int x, int y)
SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED, int x, int y)
{
magic_api *api = (magic_api *) ptr;
@ -176,25 +166,21 @@ static void do_alien_pixel(void *ptr, int which ATTRIBUTE_UNUSED,
double temp2[3];
int k;
SDL_GetRGB(api->getpixel(canvas, x, y), canvas->format, &temp[0], &temp[1],
&temp[2]);
SDL_GetRGB(api->getpixel(canvas, x, y), canvas->format, &temp[0], &temp[1], &temp[2]);
for (k = 0; k < 3; k++)
{
//EP temp2[k] = clamp(0,127.5 * (1.0 + sin (((temp[k] / 127.5 - 1.0) * alien_FREQUENCY[k] + alien_ANGLE[k] / 180.0) * M_PI)),255);
temp2[k] = clamp(0.0,
127.5 * (1.0 +
sin(((temp[k] / 127.5 -
1.0) * alien_FREQUENCY[k] +
alien_ANGLE[k] / 180.0) * M_PI)), 255.0);
1.0) * alien_FREQUENCY[k] + alien_ANGLE[k] / 180.0) * M_PI)), 255.0);
}
api->putpixel(canvas, x, y,
SDL_MapRGB(canvas->format, temp2[0], temp2[1], temp2[2]));
api->putpixel(canvas, x, y, SDL_MapRGB(canvas->format, temp2[0], temp2[1], temp2[2]));
}
// Do the effect for the full image
static void do_alien_full(void *ptr, SDL_Surface * canvas, SDL_Surface * last,
int which)
static void do_alien_full(void *ptr, SDL_Surface * canvas, SDL_Surface * last, int which)
{
int x, y;
@ -208,8 +194,7 @@ static void do_alien_full(void *ptr, SDL_Surface * canvas, SDL_Surface * last,
}
//do the effect for the brush
static void do_alien_brush(void *ptr, int which, SDL_Surface * canvas,
SDL_Surface * last, int x, int y)
static void do_alien_brush(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y)
{
int xx, yy;
magic_api *api = (magic_api *) ptr;
@ -218,8 +203,7 @@ static void do_alien_brush(void *ptr, int which, SDL_Surface * canvas,
{
for (xx = x - alien_RADIUS; xx < x + alien_RADIUS; xx++)
{
if (api->in_circle(xx - x, yy - y, alien_RADIUS)
&& !api->touched(xx, yy))
if (api->in_circle(xx - x, yy - y, alien_RADIUS) && !api->touched(xx, yy))
{
do_alien_pixel(api, which, canvas, last, xx, yy);
}
@ -229,12 +213,10 @@ static void do_alien_brush(void *ptr, int which, SDL_Surface * canvas,
// Affect the canvas on drag:
void alien_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y,
SDL_Rect * update_rect)
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect)
{
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1,
do_alien_brush);
api->line((void *)api, which, canvas, last, ox, oy, x, y, 1, do_alien_brush);
api->playsound(alien_snd_effect[which], (x * 255) / canvas->w, 255);
@ -275,8 +257,7 @@ Mix_Chunk *magic_loadsound(char *file)
// Affect the canvas on click:
void alien_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, int x, int y,
SDL_Rect * update_rect)
SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect)
{
if (mode == MODE_PAINT)
alien_drag(api, which, canvas, last, x, y, x, y, update_rect);
@ -296,8 +277,7 @@ void alien_release(magic_api * api ATTRIBUTE_UNUSED,
int which ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED,
SDL_Surface * last ATTRIBUTE_UNUSED,
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED,
SDL_Rect * update_rect ATTRIBUTE_UNUSED)
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
{
}
@ -317,14 +297,15 @@ void alien_shutdown(magic_api * api ATTRIBUTE_UNUSED)
}
// Record the color from Tux Paint:
void alien_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED,
SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
void alien_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED,
SDL_Rect * update_rect ATTRIBUTE_UNUSED)
{
}
// Use colors:
int alien_requires_colors(magic_api * api ATTRIBUTE_UNUSED,
int which ATTRIBUTE_UNUSED)
int alien_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return 0;
}
@ -340,20 +321,19 @@ Uint8 alien_default_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_U
}
void alien_set_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
Uint8 size, SDL_Rect * update_rect ATTRIBUTE_UNUSED) {
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
Uint8 size, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
{
alien_RADIUS = size * 4;
}
void alien_switchin(magic_api * api ATTRIBUTE_UNUSED,
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED)
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
{
}
void alien_switchout(magic_api * api ATTRIBUTE_UNUSED,
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED)
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
{
}