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,22 @@ SDL_Surface *smudge_get_icon(magic_api * api, int which);
|
|||
char *smudge_get_name(magic_api * api, int which);
|
||||
int smudge_get_group(magic_api * api, int which);
|
||||
char *smudge_get_description(magic_api * api, int which, int mode);
|
||||
static void do_smudge(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
|
||||
static void do_smudge(void *ptr, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y);
|
||||
void smudge_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 smudge_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
|
||||
void smudge_release(magic_api * api, int which,
|
||||
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 smudge_click(magic_api * api, int which, int mode, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
|
||||
void smudge_release(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
|
||||
void smudge_shutdown(magic_api * api);
|
||||
void smudge_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int smudge_requires_colors(magic_api * api, int which);
|
||||
void smudge_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void smudge_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void smudge_switchin(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
void smudge_switchout(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
int smudge_modes(magic_api * api, int which);
|
||||
int smudge_get_tool_count(magic_api * api);
|
||||
|
||||
|
|
@ -66,7 +70,8 @@ int smudge_init(magic_api * api)
|
|||
{
|
||||
char fname[1024];
|
||||
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/smudge.wav", api->data_directory);
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/smudge.wav",
|
||||
api->data_directory);
|
||||
smudge_snd = Mix_LoadWAV(fname);
|
||||
|
||||
return (1);
|
||||
|
|
@ -89,9 +94,11 @@ SDL_Surface *smudge_get_icon(magic_api * api, int which)
|
|||
char fname[1024];
|
||||
|
||||
if (which == 0)
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/smudge.png", api->data_directory);
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/smudge.png",
|
||||
api->data_directory);
|
||||
else /* if (which == 1) */
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/wetpaint.png", api->data_directory);
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/wetpaint.png",
|
||||
api->data_directory);
|
||||
|
||||
return (IMG_Load(fname));
|
||||
}
|
||||
|
|
@ -115,17 +122,23 @@ int smudge_get_group(magic_api * api ATTRIBUTE_UNUSED, int which)
|
|||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char *smudge_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
|
||||
char *smudge_get_description(magic_api * api ATTRIBUTE_UNUSED, int which,
|
||||
int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (which == 0)
|
||||
return (strdup(gettext_noop("Click and drag the mouse around to smudge the picture.")));
|
||||
return (strdup
|
||||
(gettext_noop
|
||||
("Click and drag the mouse around to smudge the picture.")));
|
||||
else /* if (which == 1) */
|
||||
return (strdup(gettext_noop("Click and drag the mouse around to draw with wet, smudgy paint.")));
|
||||
return (strdup
|
||||
(gettext_noop
|
||||
("Click and drag the mouse around to draw with wet, smudgy paint.")));
|
||||
}
|
||||
|
||||
// Do the effect:
|
||||
|
||||
static void do_smudge(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y)
|
||||
static void do_smudge(void *ptr, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y)
|
||||
{
|
||||
magic_api *api = (magic_api *) ptr;
|
||||
static double state[32][32][3];
|
||||
|
|
@ -135,66 +148,80 @@ static void do_smudge(void *ptr, int which, SDL_Surface * canvas, SDL_Surface *
|
|||
int xx, yy, strength;
|
||||
|
||||
if (which == 1)
|
||||
{
|
||||
/* Wet paint */
|
||||
for (yy = -8; yy < 8; yy++)
|
||||
for (xx = -8; xx < 8; xx++)
|
||||
if (api->in_circle(xx, yy, 8))
|
||||
{
|
||||
SDL_GetRGB(api->getpixel(last, x + xx, y + yy), last->format, &r, &g, &b);
|
||||
//strength = (abs(xx * yy) / 8) + 6;
|
||||
strength = (abs(xx * yy) / 8) + 1;
|
||||
api->putpixel(canvas, x + xx, y + yy, SDL_MapRGB(canvas->format,
|
||||
(smudge_r + r * strength) / (strength + 1),
|
||||
(smudge_g + g * strength) / (strength + 1),
|
||||
(smudge_b + b * strength) / (strength + 1)));
|
||||
}
|
||||
}
|
||||
{
|
||||
/* Wet paint */
|
||||
for (yy = -8; yy < 8; yy++)
|
||||
for (xx = -8; xx < 8; xx++)
|
||||
if (api->in_circle(xx, yy, 8))
|
||||
{
|
||||
SDL_GetRGB(api->getpixel(last, x + xx, y + yy), last->format, &r,
|
||||
&g, &b);
|
||||
//strength = (abs(xx * yy) / 8) + 6;
|
||||
strength = (abs(xx * yy) / 8) + 1;
|
||||
api->putpixel(canvas, x + xx, y + yy, SDL_MapRGB(canvas->format,
|
||||
(smudge_r +
|
||||
r * strength) /
|
||||
(strength + 1),
|
||||
(smudge_g +
|
||||
g * strength) /
|
||||
(strength + 1),
|
||||
(smudge_b +
|
||||
b * strength) /
|
||||
(strength + 1)));
|
||||
}
|
||||
}
|
||||
|
||||
while (i--)
|
||||
{
|
||||
int iy = i >> 5;
|
||||
int ix = i & 0x1f;
|
||||
{
|
||||
int iy = i >> 5;
|
||||
int ix = i & 0x1f;
|
||||
|
||||
// is it not on the circle of radius sqrt(120) at location 16,16?
|
||||
if ((ix - 16) * (ix - 16) + (iy - 16) * (iy - 16) > 120)
|
||||
continue;
|
||||
// it is on the circle, so grab it
|
||||
// is it not on the circle of radius sqrt(120) at location 16,16?
|
||||
if ((ix - 16) * (ix - 16) + (iy - 16) * (iy - 16) > 120)
|
||||
continue;
|
||||
// it is on the circle, so grab it
|
||||
|
||||
SDL_GetRGB(api->getpixel(canvas, x + ix - 16, y + iy - 16), last->format, &r, &g, &b);
|
||||
state[ix][iy][0] = rate * state[ix][iy][0] + (1.0 - rate) * api->sRGB_to_linear(r);
|
||||
state[ix][iy][1] = rate * state[ix][iy][1] + (1.0 - rate) * api->sRGB_to_linear(g);
|
||||
state[ix][iy][2] = rate * state[ix][iy][2] + (1.0 - rate) * api->sRGB_to_linear(b);
|
||||
SDL_GetRGB(api->getpixel(canvas, x + ix - 16, y + iy - 16), last->format,
|
||||
&r, &g, &b);
|
||||
state[ix][iy][0] =
|
||||
rate * state[ix][iy][0] + (1.0 - rate) * api->sRGB_to_linear(r);
|
||||
state[ix][iy][1] =
|
||||
rate * state[ix][iy][1] + (1.0 - rate) * api->sRGB_to_linear(g);
|
||||
state[ix][iy][2] =
|
||||
rate * state[ix][iy][2] + (1.0 - rate) * api->sRGB_to_linear(b);
|
||||
|
||||
// opacity 100% --> new data not blended w/ existing data
|
||||
api->putpixel(canvas, x + ix - 16, y + iy - 16,
|
||||
SDL_MapRGB(canvas->format, api->linear_to_sRGB(state[ix][iy][0]),
|
||||
api->linear_to_sRGB(state[ix][iy][1]), api->linear_to_sRGB(state[ix][iy][2])));
|
||||
}
|
||||
// opacity 100% --> new data not blended w/ existing data
|
||||
api->putpixel(canvas, x + ix - 16, y + iy - 16,
|
||||
SDL_MapRGB(canvas->format,
|
||||
api->linear_to_sRGB(state[ix][iy][0]),
|
||||
api->linear_to_sRGB(state[ix][iy][1]),
|
||||
api->linear_to_sRGB(state[ix][iy][2])));
|
||||
}
|
||||
}
|
||||
|
||||
// Affect the canvas on drag:
|
||||
void smudge_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_smudge);
|
||||
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1, do_smudge);
|
||||
|
||||
api->playsound(smudge_snd, (x * 255) / canvas->w, 255);
|
||||
|
||||
if (ox > x)
|
||||
{
|
||||
int tmp = ox;
|
||||
{
|
||||
int tmp = ox;
|
||||
|
||||
ox = x;
|
||||
x = tmp;
|
||||
}
|
||||
ox = x;
|
||||
x = tmp;
|
||||
}
|
||||
if (oy > y)
|
||||
{
|
||||
int tmp = oy;
|
||||
{
|
||||
int tmp = oy;
|
||||
|
||||
oy = y;
|
||||
y = tmp;
|
||||
}
|
||||
oy = y;
|
||||
y = tmp;
|
||||
}
|
||||
|
||||
update_rect->x = ox - 16;
|
||||
update_rect->y = oy - 16;
|
||||
|
|
@ -204,15 +231,19 @@ void smudge_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
|
||||
// Affect the canvas on click:
|
||||
void smudge_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)
|
||||
{
|
||||
smudge_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
||||
}
|
||||
|
||||
// Affect the canvas on click:
|
||||
void smudge_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 smudge_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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -224,7 +255,8 @@ void smudge_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
|||
}
|
||||
|
||||
// Record the color from Tux Paint:
|
||||
void smudge_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b)
|
||||
void smudge_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r, Uint8 g,
|
||||
Uint8 b)
|
||||
{
|
||||
smudge_r = r;
|
||||
smudge_g = g;
|
||||
|
|
@ -232,7 +264,8 @@ void smudge_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8
|
|||
}
|
||||
|
||||
// Use colors:
|
||||
int smudge_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
int smudge_requires_colors(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (which == 0)
|
||||
return 0;
|
||||
|
|
@ -240,12 +273,14 @@ int smudge_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE
|
|||
return 1;
|
||||
}
|
||||
|
||||
void smudge_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
void smudge_switchin(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void smudge_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
void smudge_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