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
162
magic/src/tv.c
162
magic/src/tv.c
|
|
@ -46,14 +46,18 @@ int tv_get_group(magic_api * api, int which);
|
|||
char *tv_get_description(magic_api * api, int which, int mode);
|
||||
int tv_requires_colors(magic_api * api, int which);
|
||||
void tv_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 tv_shutdown(magic_api * api);
|
||||
void tv_paint_tv(void *ptr_to_api, int which_tool, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y);
|
||||
void tv_do_tv(void *ptr_to_api, int which_tool, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y);
|
||||
void tv_paint_tv(void *ptr_to_api, int which_tool, SDL_Surface * canvas,
|
||||
SDL_Surface * snapshot, int x, int y);
|
||||
void tv_do_tv(void *ptr_to_api, int which_tool, SDL_Surface * canvas,
|
||||
SDL_Surface * snapshot, int x, int y);
|
||||
void tv_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 tv_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
|
||||
SDL_Surface * snapshot, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
void tv_click(magic_api * api, int which, int mode, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
|
||||
void tv_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void tv_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int tv_modes(magic_api * api, int which);
|
||||
|
|
@ -74,7 +78,8 @@ int tv_init(magic_api * api ATTRIBUTE_UNUSED)
|
|||
{
|
||||
char fname[1024];
|
||||
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/tv.ogg", api->data_directory);
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/tv.ogg",
|
||||
api->data_directory);
|
||||
tv_snd = Mix_LoadWAV(fname);
|
||||
|
||||
return (1);
|
||||
|
|
@ -89,12 +94,14 @@ SDL_Surface *tv_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
|||
{
|
||||
char fname[1024];
|
||||
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/tv.png", api->data_directory);
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/tv.png",
|
||||
api->data_directory);
|
||||
|
||||
return (IMG_Load(fname));
|
||||
}
|
||||
|
||||
char *tv_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
char *tv_get_name(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return strdup(gettext_noop("TV"));
|
||||
}
|
||||
|
|
@ -104,24 +111,32 @@ int tv_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
|||
return MAGIC_TYPE_DISTORTS;
|
||||
}
|
||||
|
||||
char *tv_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode)
|
||||
char *tv_get_description(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, int mode)
|
||||
{
|
||||
if (mode == MODE_PAINT)
|
||||
return strdup(gettext_noop("Click and drag to make parts of your picture look like they are on television."));
|
||||
return
|
||||
strdup(gettext_noop
|
||||
("Click and drag to make parts of your picture look like they are on television."));
|
||||
|
||||
else
|
||||
return strdup(gettext_noop("Click to make your picture look like it's on television."));
|
||||
return
|
||||
strdup(gettext_noop
|
||||
("Click to make your picture look like it's on television."));
|
||||
|
||||
}
|
||||
|
||||
int tv_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
int tv_requires_colors(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void tv_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)
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * snapshot ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED,
|
||||
SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -133,64 +148,68 @@ void tv_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
|||
// Interactivity functions
|
||||
|
||||
void tv_do_tv(void *ptr_to_api, int which_tool ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED, int x, int y)
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED,
|
||||
int x, int y)
|
||||
{
|
||||
magic_api *api = (magic_api *) ptr_to_api;
|
||||
Uint8 r, g, b, i;
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
/* Convert the line below to their red/green/blue elements */
|
||||
SDL_GetRGB(api->getpixel(snapshot, x, y + i), snapshot->format, &r, &g,
|
||||
&b);
|
||||
if (x % 3 == 0)
|
||||
{
|
||||
/* Convert the line below to their red/green/blue elements */
|
||||
SDL_GetRGB(api->getpixel(snapshot, x, y + i), snapshot->format, &r, &g, &b);
|
||||
if (x % 3 == 0)
|
||||
{
|
||||
/* Red */
|
||||
g = 0;
|
||||
b = 0;
|
||||
}
|
||||
else if (x % 3 == 1)
|
||||
{
|
||||
/* Green */
|
||||
r = 0;
|
||||
b = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Blue */
|
||||
r = 0;
|
||||
g = 0;
|
||||
}
|
||||
|
||||
r = r / (i + 1);
|
||||
g = g / (i + 1);
|
||||
b = b / (i + 1);
|
||||
|
||||
api->putpixel(canvas, x, y + i, SDL_MapRGB(canvas->format, r, g, b));
|
||||
/* Red */
|
||||
g = 0;
|
||||
b = 0;
|
||||
}
|
||||
else if (x % 3 == 1)
|
||||
{
|
||||
/* Green */
|
||||
r = 0;
|
||||
b = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Blue */
|
||||
r = 0;
|
||||
g = 0;
|
||||
}
|
||||
|
||||
r = r / (i + 1);
|
||||
g = g / (i + 1);
|
||||
b = b / (i + 1);
|
||||
|
||||
api->putpixel(canvas, x, y + i, SDL_MapRGB(canvas->format, r, g, b));
|
||||
}
|
||||
}
|
||||
|
||||
void tv_paint_tv(void *ptr_to_api, int which_tool ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED, int x, int y)
|
||||
SDL_Surface * canvas,
|
||||
SDL_Surface * snapshot ATTRIBUTE_UNUSED, int x, int y)
|
||||
{
|
||||
int i, j;
|
||||
magic_api *api = (magic_api *) ptr_to_api;
|
||||
|
||||
y = (y - (y % 2));
|
||||
y = (y - (y % 2));
|
||||
|
||||
for (i = x - RADIUS; i < x + RADIUS; i++)
|
||||
{
|
||||
for (j = y - RADIUS; j < y + RADIUS; j += 2)
|
||||
{
|
||||
for (j = y - RADIUS; j < y + RADIUS; j += 2)
|
||||
{
|
||||
if (api->in_circle(i - x, j - y, RADIUS) && !api->touched(i, j))
|
||||
{
|
||||
tv_do_tv(api, 0, canvas, snapshot, i, j);
|
||||
}
|
||||
}
|
||||
if (api->in_circle(i - x, j - y, RADIUS) && !api->touched(i, j))
|
||||
{
|
||||
tv_do_tv(api, 0, canvas, snapshot, i, j);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void tv_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Rect * update_rect)
|
||||
SDL_Surface * snapshot, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect)
|
||||
{
|
||||
api->line(api, which, canvas, snapshot, ox, oy, x, y, 1, tv_paint_tv);
|
||||
|
||||
|
|
@ -202,36 +221,39 @@ void tv_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
}
|
||||
|
||||
void tv_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_FULLSCREEN)
|
||||
{
|
||||
for (y = 0; y < canvas->h; y += 2)
|
||||
{
|
||||
for (y = 0; y < canvas->h; y += 2)
|
||||
{
|
||||
for (x = 0; x < canvas->w; x++)
|
||||
{
|
||||
tv_do_tv(api, which, canvas, last, x, y);
|
||||
}
|
||||
}
|
||||
for (x = 0; x < canvas->w; x++)
|
||||
{
|
||||
tv_do_tv(api, which, canvas, last, x, y);
|
||||
}
|
||||
}
|
||||
|
||||
update_rect->w = canvas->w;
|
||||
update_rect->h = canvas->h;
|
||||
update_rect->x = update_rect->y = 0;
|
||||
api->playsound(tv_snd, 128, 255);
|
||||
}
|
||||
update_rect->w = canvas->w;
|
||||
update_rect->h = canvas->h;
|
||||
update_rect->x = update_rect->y = 0;
|
||||
api->playsound(tv_snd, 128, 255);
|
||||
}
|
||||
else
|
||||
{
|
||||
tv_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
||||
}
|
||||
{
|
||||
tv_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
||||
}
|
||||
}
|
||||
|
||||
void tv_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
void tv_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void tv_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
void tv_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