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
|
|
@ -57,15 +57,21 @@ int stretch_get_group(magic_api * api, int which);
|
|||
char *stretch_get_description(magic_api * api, int which, int mode);
|
||||
int stretch_requires_colors(magic_api * api, int which);
|
||||
void stretch_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect);
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot, int x,
|
||||
int y, SDL_Rect * update_rect);
|
||||
void stretch_shutdown(magic_api * api);
|
||||
void stretch_paint_stretch(void *ptr_to_api, int which_tool, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y);
|
||||
void stretch_paint_stretch(void *ptr_to_api, int which_tool,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y);
|
||||
void stretch_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Rect * update_rect);
|
||||
void stretch_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
|
||||
void stretch_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void stretch_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
SDL_Surface * snapshot, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
void stretch_click(magic_api * api, int which, int mode, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
|
||||
void stretch_switchin(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
void stretch_switchout(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
int stretch_modes(magic_api * api, int which);
|
||||
|
||||
// Housekeeping functions
|
||||
|
|
@ -74,7 +80,9 @@ Uint32 stretch_api_version(void)
|
|||
return (TP_MAGIC_API_VERSION);
|
||||
}
|
||||
|
||||
void stretch_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED)
|
||||
void stretch_set_color(magic_api * api ATTRIBUTE_UNUSED,
|
||||
Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED,
|
||||
Uint8 b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -82,7 +90,8 @@ int stretch_init(magic_api * api)
|
|||
{
|
||||
char fname[1024];
|
||||
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/stretch.ogg", api->data_directory);
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/stretch.ogg",
|
||||
api->data_directory);
|
||||
stretch_snd = Mix_LoadWAV(fname);
|
||||
|
||||
return (1);
|
||||
|
|
@ -97,36 +106,45 @@ SDL_Surface *stretch_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
|||
{
|
||||
char fname[1024];
|
||||
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/stretch.png", api->data_directory);
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/stretch.png",
|
||||
api->data_directory);
|
||||
|
||||
return (IMG_Load(fname));
|
||||
}
|
||||
|
||||
char *stretch_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
char *stretch_get_name(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return strdup(gettext_noop("Stretch"));
|
||||
}
|
||||
|
||||
int stretch_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
int stretch_get_group(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return MAGIC_TYPE_PICTURE_WARPS;
|
||||
}
|
||||
|
||||
char *stretch_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||
char *stretch_get_description(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED,
|
||||
int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return
|
||||
strdup(gettext_noop
|
||||
("Click and drag to stretch part of your picture vertically or horizontally."));
|
||||
}
|
||||
|
||||
int stretch_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
int stretch_requires_colors(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void stretch_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * snapshot ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
void stretch_release(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * snapshot ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED,
|
||||
SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -137,9 +155,10 @@ void stretch_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
|||
|
||||
// Interactivity functions
|
||||
|
||||
void stretch_drag(magic_api * api, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas,
|
||||
SDL_Surface * snapshot, int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void stretch_drag(magic_api * api, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED, int x,
|
||||
int y, SDL_Rect * update_rect)
|
||||
{
|
||||
SDL_Rect src, dest;
|
||||
float xx, yy;
|
||||
|
|
@ -148,92 +167,94 @@ void stretch_drag(magic_api * api, int which ATTRIBUTE_UNUSED, SDL_Surface * can
|
|||
SDL_BlitSurface(snapshot, NULL, canvas, NULL);
|
||||
|
||||
switch (stretch_side)
|
||||
{
|
||||
case STRETCH_DIRECTION_VERT:
|
||||
{
|
||||
case STRETCH_DIRECTION_VERT:
|
||||
if (y != stretch_start_y)
|
||||
{
|
||||
if (y != stretch_start_y)
|
||||
{
|
||||
divisor1 = (float) y / (float) stretch_start_y;
|
||||
divisor2 = (float) (canvas->h - y) / (float) (canvas->h - stretch_start_y);
|
||||
divisor1 = (float) y / (float) stretch_start_y;
|
||||
divisor2 =
|
||||
(float) (canvas->h - y) / (float) (canvas->h - stretch_start_y);
|
||||
|
||||
for (yy = 0; yy < y; yy++)
|
||||
{
|
||||
src.x = 0;
|
||||
src.y = (yy / divisor1);
|
||||
src.w = canvas->w;
|
||||
src.h = 1;
|
||||
for (yy = 0; yy < y; yy++)
|
||||
{
|
||||
src.x = 0;
|
||||
src.y = (yy / divisor1);
|
||||
src.w = canvas->w;
|
||||
src.h = 1;
|
||||
|
||||
dest.x = 0;
|
||||
dest.y = yy;
|
||||
dest.w = canvas->w;
|
||||
dest.h = 1;
|
||||
dest.x = 0;
|
||||
dest.y = yy;
|
||||
dest.w = canvas->w;
|
||||
dest.h = 1;
|
||||
|
||||
SDL_BlitSurface(snapshot, &src, canvas, &dest);
|
||||
}
|
||||
SDL_BlitSurface(snapshot, &src, canvas, &dest);
|
||||
}
|
||||
|
||||
for (yy = y; yy < canvas->h; yy++)
|
||||
{
|
||||
src.x = 0;
|
||||
src.y = stretch_start_y + ((yy - y) / divisor2);
|
||||
src.w = canvas->w;
|
||||
src.h = 1;
|
||||
for (yy = y; yy < canvas->h; yy++)
|
||||
{
|
||||
src.x = 0;
|
||||
src.y = stretch_start_y + ((yy - y) / divisor2);
|
||||
src.w = canvas->w;
|
||||
src.h = 1;
|
||||
|
||||
dest.x = 0;
|
||||
dest.y = yy;
|
||||
dest.w = canvas->w;
|
||||
dest.h = 1;
|
||||
dest.x = 0;
|
||||
dest.y = yy;
|
||||
dest.w = canvas->w;
|
||||
dest.h = 1;
|
||||
|
||||
SDL_BlitSurface(snapshot, &src, canvas, &dest);
|
||||
}
|
||||
SDL_BlitSurface(snapshot, &src, canvas, &dest);
|
||||
}
|
||||
|
||||
api->playsound(stretch_snd, 128, 255);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case STRETCH_DIRECTION_HORIZ:
|
||||
{
|
||||
if (x != stretch_start_x)
|
||||
{
|
||||
divisor1 = (float) x / (float) stretch_start_x;
|
||||
divisor2 = (float) (canvas->w - x) / (float) (canvas->w - stretch_start_x);
|
||||
|
||||
for (xx = 0; xx < x; xx++)
|
||||
{
|
||||
src.x = (xx / divisor1);
|
||||
src.y = 0;
|
||||
src.w = 1;
|
||||
src.h = canvas->h;
|
||||
|
||||
dest.x = xx;
|
||||
dest.y = 0;
|
||||
dest.w = 1;
|
||||
dest.h = canvas->h;
|
||||
|
||||
SDL_BlitSurface(snapshot, &src, canvas, &dest);
|
||||
}
|
||||
|
||||
for (xx = x; xx < canvas->w; xx++)
|
||||
{
|
||||
src.x = stretch_start_x + ((xx - x) / divisor2);
|
||||
src.y = 0;
|
||||
src.w = 1;
|
||||
src.h = canvas->h;
|
||||
|
||||
dest.x = xx;
|
||||
dest.y = 0;
|
||||
dest.w = 1;
|
||||
dest.h = canvas->h;
|
||||
|
||||
SDL_BlitSurface(snapshot, &src, canvas, &dest);
|
||||
}
|
||||
api->playsound(stretch_snd, (x * 255) / canvas->w, 255);
|
||||
}
|
||||
|
||||
break;
|
||||
api->playsound(stretch_snd, 128, 255);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case STRETCH_DIRECTION_HORIZ:
|
||||
{
|
||||
if (x != stretch_start_x)
|
||||
{
|
||||
divisor1 = (float) x / (float) stretch_start_x;
|
||||
divisor2 =
|
||||
(float) (canvas->w - x) / (float) (canvas->w - stretch_start_x);
|
||||
|
||||
for (xx = 0; xx < x; xx++)
|
||||
{
|
||||
src.x = (xx / divisor1);
|
||||
src.y = 0;
|
||||
src.w = 1;
|
||||
src.h = canvas->h;
|
||||
|
||||
dest.x = xx;
|
||||
dest.y = 0;
|
||||
dest.w = 1;
|
||||
dest.h = canvas->h;
|
||||
|
||||
SDL_BlitSurface(snapshot, &src, canvas, &dest);
|
||||
}
|
||||
|
||||
for (xx = x; xx < canvas->w; xx++)
|
||||
{
|
||||
src.x = stretch_start_x + ((xx - x) / divisor2);
|
||||
src.y = 0;
|
||||
src.w = 1;
|
||||
src.h = canvas->h;
|
||||
|
||||
dest.x = xx;
|
||||
dest.y = 0;
|
||||
dest.w = 1;
|
||||
dest.h = canvas->h;
|
||||
|
||||
SDL_BlitSurface(snapshot, &src, canvas, &dest);
|
||||
}
|
||||
api->playsound(stretch_snd, (x * 255) / canvas->w, 255);
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
update_rect->x = 0;
|
||||
update_rect->y = 0;
|
||||
update_rect->w = canvas->w;
|
||||
|
|
@ -241,26 +262,27 @@ void stretch_drag(magic_api * api, int which ATTRIBUTE_UNUSED, SDL_Surface * can
|
|||
}
|
||||
|
||||
void stretch_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
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 (y < canvas->h / 2)
|
||||
{
|
||||
if (x < y)
|
||||
stretch_side = STRETCH_DIRECTION_HORIZ;
|
||||
else if (canvas->w - x < y)
|
||||
stretch_side = STRETCH_DIRECTION_HORIZ;
|
||||
else
|
||||
stretch_side = STRETCH_DIRECTION_VERT;
|
||||
}
|
||||
{
|
||||
if (x < y)
|
||||
stretch_side = STRETCH_DIRECTION_HORIZ;
|
||||
else if (canvas->w - x < y)
|
||||
stretch_side = STRETCH_DIRECTION_HORIZ;
|
||||
else
|
||||
stretch_side = STRETCH_DIRECTION_VERT;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x < canvas->h - y)
|
||||
stretch_side = STRETCH_DIRECTION_HORIZ;
|
||||
else if (canvas->w - x < canvas->h - y)
|
||||
stretch_side = STRETCH_DIRECTION_HORIZ;
|
||||
else
|
||||
stretch_side = STRETCH_DIRECTION_VERT;
|
||||
}
|
||||
{
|
||||
if (x < canvas->h - y)
|
||||
stretch_side = STRETCH_DIRECTION_HORIZ;
|
||||
else if (canvas->w - x < canvas->h - y)
|
||||
stretch_side = STRETCH_DIRECTION_HORIZ;
|
||||
else
|
||||
stretch_side = STRETCH_DIRECTION_VERT;
|
||||
}
|
||||
|
||||
stretch_start_x = x;
|
||||
stretch_start_y = y;
|
||||
|
|
@ -268,19 +290,22 @@ void stretch_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
|||
stretch_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
||||
}
|
||||
|
||||
void stretch_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
void stretch_switchin(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void stretch_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
void stretch_switchout(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
int stretch_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
int stretch_modes(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return (MODE_PAINT);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue