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
|
|
@ -46,18 +46,24 @@ SDL_Surface *glasstile_get_icon(magic_api * api, int which);
|
|||
char *glasstile_get_name(magic_api * api, int which);
|
||||
int glasstile_get_group(magic_api * api, int which);
|
||||
char *glasstile_get_description(magic_api * api, int which, int mode);
|
||||
static void do_glasstile(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
|
||||
static void do_glasstile(void *ptr, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y);
|
||||
void glasstile_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);
|
||||
void glasstile_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
|
||||
void glasstile_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 glasstile_release(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
void glasstile_shutdown(magic_api * api);
|
||||
void glasstile_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int glasstile_requires_colors(magic_api * api, int which);
|
||||
void glasstile_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void glasstile_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void glasstile_switchin(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
void glasstile_switchout(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
int glasstile_modes(magic_api * api, int which);
|
||||
|
||||
Uint32 glasstile_api_version(void)
|
||||
|
|
@ -74,7 +80,8 @@ int glasstile_init(magic_api * api)
|
|||
{
|
||||
char fname[1024];
|
||||
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/glasstile.ogg", api->data_directory);
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/glasstile.ogg",
|
||||
api->data_directory);
|
||||
glasstile_snd = Mix_LoadWAV(fname);
|
||||
|
||||
glasstile_hit = NULL;
|
||||
|
|
@ -94,35 +101,45 @@ SDL_Surface *glasstile_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
|||
{
|
||||
char fname[1024];
|
||||
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/glasstile.png", api->data_directory);
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/glasstile.png",
|
||||
api->data_directory);
|
||||
|
||||
return (IMG_Load(fname));
|
||||
}
|
||||
|
||||
// Return our names, localized:
|
||||
char *glasstile_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
char *glasstile_get_name(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return (strdup(gettext_noop("Glass Tile")));
|
||||
}
|
||||
|
||||
// Return our groups
|
||||
int glasstile_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
int glasstile_get_group(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return MAGIC_TYPE_DISTORTS;
|
||||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char *glasstile_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode)
|
||||
char *glasstile_get_description(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, int mode)
|
||||
{
|
||||
if (mode == MODE_PAINT)
|
||||
return (strdup(gettext_noop("Click and drag the mouse to put glass tile over your picture.")));
|
||||
return (strdup
|
||||
(gettext_noop
|
||||
("Click and drag the mouse to put glass tile over your picture.")));
|
||||
else
|
||||
return (strdup(gettext_noop("Click to cover your entire picture in glass tiles.")));
|
||||
return (strdup
|
||||
(gettext_noop
|
||||
("Click to cover your entire picture in glass tiles.")));
|
||||
}
|
||||
|
||||
// Do the effect:
|
||||
|
||||
static void do_glasstile(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * last, int x, int y)
|
||||
static void do_glasstile(void *ptr, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last, int x,
|
||||
int y)
|
||||
{
|
||||
magic_api *api = (magic_api *) ptr;
|
||||
int xx, yy, xl, xr, yt, yb;
|
||||
|
|
@ -153,61 +170,66 @@ static void do_glasstile(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * ca
|
|||
/* Apply the effect: */
|
||||
|
||||
for (yy = -GT_SIZE; yy < GT_SIZE; yy = yy + 2)
|
||||
{
|
||||
for (xx = -GT_SIZE; xx < GT_SIZE; xx = xx + 2)
|
||||
{
|
||||
for (xx = -GT_SIZE; xx < GT_SIZE; xx = xx + 2)
|
||||
{
|
||||
SDL_GetRGB(api->getpixel(last, x + xx, y + yy), last->format, &r1, &g1, &b1);
|
||||
SDL_GetRGB(api->getpixel(last, x + xx + 1, y + yy), last->format, &r2, &g2, &b2);
|
||||
SDL_GetRGB(api->getpixel(last, x + xx, y + yy + 1), last->format, &r3, &g3, &b3);
|
||||
SDL_GetRGB(api->getpixel(last, x + xx + 1, y + yy + 1), last->format, &r4, &g4, &b4);
|
||||
SDL_GetRGB(api->getpixel(last, x + xx, y + yy), last->format, &r1, &g1,
|
||||
&b1);
|
||||
SDL_GetRGB(api->getpixel(last, x + xx + 1, y + yy), last->format, &r2,
|
||||
&g2, &b2);
|
||||
SDL_GetRGB(api->getpixel(last, x + xx, y + yy + 1), last->format, &r3,
|
||||
&g3, &b3);
|
||||
SDL_GetRGB(api->getpixel(last, x + xx + 1, y + yy + 1), last->format,
|
||||
&r4, &g4, &b4);
|
||||
|
||||
r = (r1 + r2 + r3 + r4) >> 2;
|
||||
g = (g1 + g2 + g3 + g4) >> 2;
|
||||
b = (b1 + b2 + b3 + b4) >> 2;
|
||||
r = (r1 + r2 + r3 + r4) >> 2;
|
||||
g = (g1 + g2 + g3 + g4) >> 2;
|
||||
b = (b1 + b2 + b3 + b4) >> 2;
|
||||
|
||||
if (xx <= -GT_SIZE + 2 || yy == -GT_SIZE + 2)
|
||||
{
|
||||
r = min(255, r + 64);
|
||||
g = min(255, g + 64);
|
||||
b = min(255, b + 64);
|
||||
}
|
||||
else if (xx >= GT_SIZE - 3 || yy >= GT_SIZE - 3)
|
||||
{
|
||||
r = max(0, r - 64);
|
||||
g = max(0, g - 64);
|
||||
b = max(0, b - 64);
|
||||
}
|
||||
if (xx <= -GT_SIZE + 2 || yy == -GT_SIZE + 2)
|
||||
{
|
||||
r = min(255, r + 64);
|
||||
g = min(255, g + 64);
|
||||
b = min(255, b + 64);
|
||||
}
|
||||
else if (xx >= GT_SIZE - 3 || yy >= GT_SIZE - 3)
|
||||
{
|
||||
r = max(0, r - 64);
|
||||
g = max(0, g - 64);
|
||||
b = max(0, b - 64);
|
||||
}
|
||||
|
||||
rgb = SDL_MapRGB(canvas->format, r, g, b);
|
||||
rgb = SDL_MapRGB(canvas->format, r, g, b);
|
||||
|
||||
xl = (xx / 3) - GT_SIZE + (GT_SIZE / 3);
|
||||
xr = (xx / 3) + (GT_SIZE * 2) / 3;
|
||||
yt = (yy / 3) - GT_SIZE + (GT_SIZE / 3);
|
||||
yb = (yy / 3) + (GT_SIZE * 2) / 3;
|
||||
xl = (xx / 3) - GT_SIZE + (GT_SIZE / 3);
|
||||
xr = (xx / 3) + (GT_SIZE * 2) / 3;
|
||||
yt = (yy / 3) - GT_SIZE + (GT_SIZE / 3);
|
||||
yb = (yy / 3) + (GT_SIZE * 2) / 3;
|
||||
|
||||
api->putpixel(canvas, x + xl, y + yt, rgb);
|
||||
api->putpixel(canvas, x + xx / 2, y + yt, rgb);
|
||||
api->putpixel(canvas, x + xr, y + yt, rgb);
|
||||
api->putpixel(canvas, x + xl, y + yt, rgb);
|
||||
api->putpixel(canvas, x + xx / 2, y + yt, rgb);
|
||||
api->putpixel(canvas, x + xr, y + yt, rgb);
|
||||
|
||||
api->putpixel(canvas, x + xl, y + yy / 2, rgb);
|
||||
api->putpixel(canvas, x + xr, y + yy / 2, rgb);
|
||||
api->putpixel(canvas, x + xl, y + yy / 2, rgb);
|
||||
api->putpixel(canvas, x + xr, y + yy / 2, rgb);
|
||||
|
||||
api->putpixel(canvas, x + xl, y + yb, rgb);
|
||||
api->putpixel(canvas, x + xx / 2, y + yb, rgb);
|
||||
api->putpixel(canvas, x + xr, y + yb, rgb);
|
||||
api->putpixel(canvas, x + xl, y + yb, rgb);
|
||||
api->putpixel(canvas, x + xx / 2, y + yb, rgb);
|
||||
api->putpixel(canvas, x + xr, y + yb, rgb);
|
||||
|
||||
/* Center */
|
||||
/* Center */
|
||||
|
||||
api->putpixel(canvas, x + xx / 2, y + yy / 2, rgb);
|
||||
}
|
||||
api->putpixel(canvas, x + xx / 2, y + yy / 2, rgb);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Affect the canvas on drag:
|
||||
void glasstile_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_glasstile);
|
||||
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1, do_glasstile);
|
||||
|
||||
update_rect->x = 0;
|
||||
update_rect->y = 0;
|
||||
|
|
@ -240,20 +262,21 @@ void glasstile_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
|
||||
// Affect the canvas on click:
|
||||
void glasstile_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)
|
||||
{
|
||||
int xx, yy;
|
||||
|
||||
if (glasstile_hit == NULL)
|
||||
{
|
||||
glasstile_hit_ysize = (canvas->h / GT_SIZE) + 1;
|
||||
glasstile_hit_xsize = (canvas->w / GT_SIZE) + 1;
|
||||
{
|
||||
glasstile_hit_ysize = (canvas->h / GT_SIZE) + 1;
|
||||
glasstile_hit_xsize = (canvas->w / GT_SIZE) + 1;
|
||||
|
||||
glasstile_hit = (int * *)malloc(sizeof(int *) * glasstile_hit_ysize);
|
||||
glasstile_hit = (int * *) malloc(sizeof(int *) * glasstile_hit_ysize);
|
||||
|
||||
for (yy = 0; yy < glasstile_hit_ysize; yy++)
|
||||
glasstile_hit[yy] = (int *)malloc(sizeof(int) * glasstile_hit_xsize);
|
||||
}
|
||||
for (yy = 0; yy < glasstile_hit_ysize; yy++)
|
||||
glasstile_hit[yy] = (int *) malloc(sizeof(int) * glasstile_hit_xsize);
|
||||
}
|
||||
|
||||
for (yy = 0; yy < glasstile_hit_ysize; yy++)
|
||||
for (xx = 0; xx < glasstile_hit_xsize; xx++)
|
||||
|
|
@ -262,24 +285,27 @@ void glasstile_click(magic_api * api, int which, int mode,
|
|||
if (mode == MODE_PAINT)
|
||||
glasstile_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
||||
else if (mode == MODE_FULLSCREEN)
|
||||
{
|
||||
for (y = 0; y < canvas->h; y = y + GT_SIZE)
|
||||
for (x = 0; x < canvas->w; x = x + GT_SIZE)
|
||||
do_glasstile(api, which, canvas, last, x, y);
|
||||
{
|
||||
for (y = 0; y < canvas->h; y = y + GT_SIZE)
|
||||
for (x = 0; x < canvas->w; x = x + GT_SIZE)
|
||||
do_glasstile(api, which, canvas, last, x, y);
|
||||
|
||||
update_rect->x = 0;
|
||||
update_rect->y = 0;
|
||||
update_rect->w = canvas->w;
|
||||
update_rect->h = canvas->h;
|
||||
update_rect->x = 0;
|
||||
update_rect->y = 0;
|
||||
update_rect->w = canvas->w;
|
||||
update_rect->h = canvas->h;
|
||||
|
||||
api->playsound(glasstile_snd, 128, 255);
|
||||
}
|
||||
api->playsound(glasstile_snd, 128, 255);
|
||||
}
|
||||
}
|
||||
|
||||
// Affect the canvas on release:
|
||||
void glasstile_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 glasstile_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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -292,39 +318,45 @@ void glasstile_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
|||
Mix_FreeChunk(glasstile_snd);
|
||||
|
||||
if (glasstile_hit != NULL)
|
||||
{
|
||||
for (y = 0; y < glasstile_hit_ysize; y++)
|
||||
{
|
||||
for (y = 0; y < glasstile_hit_ysize; y++)
|
||||
{
|
||||
if (glasstile_hit[y] != NULL)
|
||||
free(glasstile_hit[y]);
|
||||
}
|
||||
free(glasstile_hit);
|
||||
if (glasstile_hit[y] != NULL)
|
||||
free(glasstile_hit[y]);
|
||||
}
|
||||
free(glasstile_hit);
|
||||
}
|
||||
}
|
||||
|
||||
// Record the color from Tux Paint:
|
||||
void glasstile_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED,
|
||||
void glasstile_set_color(magic_api * api ATTRIBUTE_UNUSED,
|
||||
Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED,
|
||||
Uint8 b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// Use colors:
|
||||
int glasstile_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
int glasstile_requires_colors(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void glasstile_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
void glasstile_switchin(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void glasstile_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
void glasstile_switchout(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED,
|
||||
int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int glasstile_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
int glasstile_modes(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return (MODE_PAINT | MODE_FULLSCREEN);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue