Re-ran indent on all .c & .h source code files
Like so --
find . -name "*.c" -or -name "*.h" -exec indent -nbfda -npcs -npsl -bli0 --no-tabs {} \;
The `indent` invocation differs from the last one noted in
CHANGES.txt (from 2006!?), in that I've added "--no-tabs",
to ensure indents are all space-based.
This commit is contained in:
parent
09f332367f
commit
cc05925d9e
99 changed files with 31659 additions and 27102 deletions
172
magic/src/snow.c
172
magic/src/snow.c
|
|
@ -84,19 +84,24 @@ SDL_Surface *snow_get_icon(magic_api * api, int which);
|
|||
char *snow_get_name(magic_api * api, int which);
|
||||
int snow_get_group(magic_api * api, int which);
|
||||
char *snow_get_description(magic_api * api, int which);
|
||||
static void do_snow(void *ptr, SDL_Surface * canvas, SDL_Surface * last, int which, int snowAmount);
|
||||
static void do_snow(void *ptr, SDL_Surface * canvas, SDL_Surface * last,
|
||||
int which, int snowAmount);
|
||||
void snow_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect);
|
||||
void snow_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
void snow_click(magic_api * api, int which, int mode, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
|
||||
|
||||
void snow_release(magic_api * api, int which,
|
||||
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 snow_shutdown(magic_api * api);
|
||||
void snow_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int snow_requires_colors(magic_api * api, int which);
|
||||
void snow_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void snow_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void snow_switchin(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
void snow_switchout(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
int snow_modes(magic_api * api, int which);
|
||||
Uint32 snow_api_version(void)
|
||||
{
|
||||
|
|
@ -112,29 +117,32 @@ int snow_init(magic_api * api)
|
|||
|
||||
srand(time(0));
|
||||
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/Snow_flake4.png", api->data_directory);
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/Snow_flake4.png",
|
||||
api->data_directory);
|
||||
snow_flake1 = IMG_Load(fname);
|
||||
if (snow_flake1 == NULL)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/Snow_flake5.png", api->data_directory);
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/Snow_flake5.png",
|
||||
api->data_directory);
|
||||
snow_flake2 = IMG_Load(fname);
|
||||
if (snow_flake2 == NULL)
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
{
|
||||
return (0);
|
||||
}
|
||||
|
||||
if (snow_flake2 == NULL)
|
||||
{
|
||||
printf("meh\n");
|
||||
}
|
||||
{
|
||||
printf("meh\n");
|
||||
}
|
||||
for (i = 0; i < snow_NUM_TOOLS; i++)
|
||||
{
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/%s", api->data_directory, snow_snd_filenames[i]);
|
||||
snow_snd_effect[i] = Mix_LoadWAV(fname);
|
||||
}
|
||||
{
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/%s", api->data_directory,
|
||||
snow_snd_filenames[i]);
|
||||
snow_snd_effect[i] = Mix_LoadWAV(fname);
|
||||
}
|
||||
return (1);
|
||||
}
|
||||
|
||||
|
|
@ -148,7 +156,8 @@ SDL_Surface *snow_get_icon(magic_api * api, int which)
|
|||
{
|
||||
char fname[1024];
|
||||
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/%s", api->data_directory, snow_icon_filenames[which]);
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/%s", api->data_directory,
|
||||
snow_icon_filenames[which]);
|
||||
return (IMG_Load(fname));
|
||||
}
|
||||
|
||||
|
|
@ -158,9 +167,10 @@ char *snow_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
|
|||
return (strdup(gettext_noop(snow_names[which])));
|
||||
}
|
||||
|
||||
int snow_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
int snow_get_group(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return MAGIC_TYPE_PICTURE_DECORATIONS; /* Because we affect the whole image, and not just around the mouse */
|
||||
return MAGIC_TYPE_PICTURE_DECORATIONS; /* Because we affect the whole image, and not just around the mouse */
|
||||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
|
|
@ -170,7 +180,8 @@ char *snow_get_description(magic_api * api ATTRIBUTE_UNUSED, int which)
|
|||
}
|
||||
|
||||
// Do the effect:
|
||||
static void do_snow(void *ptr, SDL_Surface * canvas, SDL_Surface * last, int which, int snowAmount)
|
||||
static void do_snow(void *ptr, SDL_Surface * canvas, SDL_Surface * last,
|
||||
int which, int snowAmount)
|
||||
{
|
||||
magic_api *api = (magic_api *) ptr;
|
||||
|
||||
|
|
@ -179,43 +190,48 @@ static void do_snow(void *ptr, SDL_Surface * canvas, SDL_Surface * last, int whi
|
|||
SDL_Rect dest;
|
||||
|
||||
for (i = 0; i < snowAmount; i++)
|
||||
{
|
||||
centre_x = rand() % canvas->w;
|
||||
centre_y = rand() % canvas->h;
|
||||
if (which == TOOL_SNOWBALL)
|
||||
{
|
||||
centre_x = rand() % canvas->w;
|
||||
centre_y = rand() % canvas->h;
|
||||
if (which == TOOL_SNOWBALL)
|
||||
for (y = -snow_RADIUS; y < snow_RADIUS; y++)
|
||||
{
|
||||
for (x = -snow_RADIUS; x < snow_RADIUS; x++)
|
||||
{
|
||||
for (y = -snow_RADIUS; y < snow_RADIUS; y++)
|
||||
{
|
||||
for (x = -snow_RADIUS; x < snow_RADIUS; x++)
|
||||
{
|
||||
if (api->in_circle(x, y, snow_RADIUS))
|
||||
{
|
||||
SDL_GetRGB(api->getpixel(last, centre_x + x, centre_y + y), last->format, &r, &g, &b);
|
||||
api->putpixel(canvas, centre_x + x, centre_y + y, SDL_MapRGB(canvas->format, 255, 255, 255));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (which == TOOL_SNOWFLAKE)
|
||||
{
|
||||
dest.x = centre_x;
|
||||
dest.y = centre_y;
|
||||
if (rand() % 2 == 0)
|
||||
{
|
||||
SDL_BlitSurface(snow_flake1, NULL, canvas, &dest);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_BlitSurface(snow_flake2, NULL, canvas, &dest);
|
||||
}
|
||||
if (api->in_circle(x, y, snow_RADIUS))
|
||||
{
|
||||
SDL_GetRGB(api->getpixel(last, centre_x + x, centre_y + y),
|
||||
last->format, &r, &g, &b);
|
||||
api->putpixel(canvas, centre_x + x, centre_y + y,
|
||||
SDL_MapRGB(canvas->format, 255, 255, 255));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (which == TOOL_SNOWFLAKE)
|
||||
{
|
||||
dest.x = centre_x;
|
||||
dest.y = centre_y;
|
||||
if (rand() % 2 == 0)
|
||||
{
|
||||
SDL_BlitSurface(snow_flake1, NULL, canvas, &dest);
|
||||
}
|
||||
else
|
||||
{
|
||||
SDL_BlitSurface(snow_flake2, NULL, canvas, &dest);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Affect the canvas on drag:
|
||||
void snow_drag(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * last ATTRIBUTE_UNUSED, int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
void snow_drag(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * last ATTRIBUTE_UNUSED, int ox ATTRIBUTE_UNUSED,
|
||||
int oy ATTRIBUTE_UNUSED, int x ATTRIBUTE_UNUSED,
|
||||
int y ATTRIBUTE_UNUSED,
|
||||
SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
// No-op
|
||||
}
|
||||
|
|
@ -223,7 +239,8 @@ void snow_drag(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL
|
|||
// Affect the canvas on click:
|
||||
void snow_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect)
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED,
|
||||
SDL_Rect * update_rect)
|
||||
{
|
||||
update_rect->x = 0;
|
||||
update_rect->y = 0;
|
||||
|
|
@ -235,9 +252,12 @@ void snow_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
|||
}
|
||||
|
||||
// Affect the canvas on release:
|
||||
void snow_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)
|
||||
void snow_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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -248,40 +268,44 @@ void snow_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
|||
int i;
|
||||
|
||||
for (i = 0; i < snow_NUM_TOOLS; i++)
|
||||
{
|
||||
if (snow_snd_effect[i] != NULL)
|
||||
{
|
||||
if (snow_snd_effect[i] != NULL)
|
||||
{
|
||||
Mix_FreeChunk(snow_snd_effect[i]);
|
||||
}
|
||||
Mix_FreeChunk(snow_snd_effect[i]);
|
||||
}
|
||||
}
|
||||
if (snow_flake1 != NULL)
|
||||
{
|
||||
SDL_FreeSurface(snow_flake1);
|
||||
}
|
||||
{
|
||||
SDL_FreeSurface(snow_flake1);
|
||||
}
|
||||
if (snow_flake2 != NULL)
|
||||
{
|
||||
SDL_FreeSurface(snow_flake2);
|
||||
}
|
||||
{
|
||||
SDL_FreeSurface(snow_flake2);
|
||||
}
|
||||
}
|
||||
|
||||
// Record the color from Tux Paint:
|
||||
void snow_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED,
|
||||
void snow_set_color(magic_api * api ATTRIBUTE_UNUSED,
|
||||
Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED,
|
||||
Uint8 b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// Use colors:
|
||||
int snow_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
int snow_requires_colors(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void snow_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
void snow_switchin(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void snow_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
void snow_switchout(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue