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
|
|
@ -62,15 +62,20 @@ int blind_get_group(magic_api * api, int which);
|
|||
char *blind_get_description(magic_api * api, int which, int mode);
|
||||
int blind_requires_colors(magic_api * api, int which);
|
||||
void blind_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 blind_shutdown(magic_api * api);
|
||||
void blind_paint_blind(void *ptr_to_api, int which_tool, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y);
|
||||
void blind_paint_blind(void *ptr_to_api, int which_tool, SDL_Surface * canvas,
|
||||
SDL_Surface * snapshot, int x, int y);
|
||||
void blind_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 blind_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
|
||||
void blind_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void blind_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 blind_click(magic_api * api, int which, int mode, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
|
||||
void blind_switchin(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
void blind_switchout(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
int blind_modes(magic_api * api, int which);
|
||||
|
||||
// Housekeeping functions
|
||||
|
|
@ -91,7 +96,8 @@ int blind_init(magic_api * api)
|
|||
{
|
||||
char fname[1024];
|
||||
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/blind.ogg", api->data_directory);
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/blind.ogg",
|
||||
api->data_directory);
|
||||
blind_snd = Mix_LoadWAV(fname);
|
||||
|
||||
return (1);
|
||||
|
|
@ -106,36 +112,45 @@ SDL_Surface *blind_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
|||
{
|
||||
char fname[1024];
|
||||
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/blind.png", api->data_directory);
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/blind.png",
|
||||
api->data_directory);
|
||||
|
||||
return (IMG_Load(fname));
|
||||
}
|
||||
|
||||
char *blind_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
char *blind_get_name(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return strdup(gettext_noop("Blind"));
|
||||
}
|
||||
|
||||
int blind_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
int blind_get_group(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return MAGIC_TYPE_PICTURE_DECORATIONS;
|
||||
}
|
||||
|
||||
char *blind_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||
char *blind_get_description(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED,
|
||||
int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return
|
||||
strdup(gettext_noop
|
||||
("Click towards the edge of your picture to pull window blinds over it. Move perpendicularly to open or close the blinds."));
|
||||
}
|
||||
|
||||
int blind_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
int blind_requires_colors(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
void blind_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 blind_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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -147,12 +162,14 @@ void blind_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
|||
// Interactivity functions
|
||||
|
||||
void blind_paint_blind(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;
|
||||
|
||||
api->putpixel(canvas, x, y,
|
||||
SDL_MapRGB(canvas->format, (blind_r + blind_light) / 2, (blind_g + blind_light) / 2,
|
||||
SDL_MapRGB(canvas->format, (blind_r + blind_light) / 2,
|
||||
(blind_g + blind_light) / 2,
|
||||
(blind_b + blind_light) / 2));
|
||||
}
|
||||
|
||||
|
|
@ -167,145 +184,157 @@ void blind_paint_blind(void *ptr_to_api, int which_tool ATTRIBUTE_UNUSED,
|
|||
|
||||
*/
|
||||
void blind_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)
|
||||
{
|
||||
int opaque;
|
||||
|
||||
SDL_BlitSurface(snapshot, NULL, canvas, NULL);
|
||||
switch (blind_side)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
case BLIND_SIDE_TOP:
|
||||
opaque = max((x * BLIND_THICKNESS) / canvas->w + 2, 2);
|
||||
for (i = y; i >= 0; i -= BLIND_THICKNESS)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
case BLIND_SIDE_TOP:
|
||||
opaque = max((x * BLIND_THICKNESS) / canvas->w + 2, 2);
|
||||
for (i = y; i >= 0; i -= BLIND_THICKNESS)
|
||||
{
|
||||
blind_light = 255;
|
||||
for (j = i; j > i - opaque / 2; j--)
|
||||
{
|
||||
api->line(api, which, canvas, snapshot, 0, j, canvas->w, j, 1, blind_paint_blind);
|
||||
blind_light -= 20;
|
||||
}
|
||||
for (j = i - opaque / 2; j > i - opaque; j--)
|
||||
{
|
||||
api->line(api, which, canvas, snapshot, 0, j, canvas->w, j, 1, blind_paint_blind);
|
||||
blind_light += 20;
|
||||
}
|
||||
}
|
||||
update_rect->x = 0;
|
||||
update_rect->y = 0;
|
||||
update_rect->w = canvas->w;
|
||||
update_rect->h = max(oy, y);
|
||||
api->playsound(blind_snd, 128, 255);
|
||||
break;
|
||||
|
||||
case BLIND_SIDE_BOTTOM:
|
||||
opaque = max((x * BLIND_THICKNESS) / canvas->w + 2, 2);
|
||||
for (i = y; i <= canvas->h; i += BLIND_THICKNESS)
|
||||
{
|
||||
blind_light = 255;
|
||||
for (j = i; j < i + opaque / 2; j++)
|
||||
{
|
||||
api->line(api, which, canvas, snapshot, 0, j, canvas->w, j, 1, blind_paint_blind);
|
||||
blind_light -= 20;
|
||||
}
|
||||
for (j = i + opaque / 2; j < i + opaque; j++)
|
||||
{
|
||||
api->line(api, which, canvas, snapshot, 0, j, canvas->w, j, 1, blind_paint_blind);
|
||||
blind_light += 20;
|
||||
}
|
||||
}
|
||||
|
||||
update_rect->x = 0;
|
||||
update_rect->y = min(oy, y);
|
||||
update_rect->w = canvas->w;
|
||||
update_rect->h = canvas->h - update_rect->y;
|
||||
api->playsound(blind_snd, 128, 255);
|
||||
break;
|
||||
|
||||
case BLIND_SIDE_RIGHT:
|
||||
opaque = max((y * BLIND_THICKNESS) / canvas->h + 2, 2);
|
||||
for (i = x; i <= canvas->w; i += BLIND_THICKNESS)
|
||||
{
|
||||
blind_light = 255;
|
||||
for (j = i; j < i + opaque / 2; j++)
|
||||
{
|
||||
api->line(api, which, canvas, snapshot, j, 0, j, canvas->h, 1, blind_paint_blind);
|
||||
blind_light -= 20;
|
||||
}
|
||||
for (j = i + opaque / 2; j < i + opaque; j++)
|
||||
{
|
||||
api->line(api, which, canvas, snapshot, j, 0, j, canvas->h, 1, blind_paint_blind);
|
||||
blind_light += 20;
|
||||
}
|
||||
}
|
||||
|
||||
update_rect->x = min(ox, x);
|
||||
update_rect->y = 0;
|
||||
update_rect->w = canvas->w - update_rect->x;
|
||||
update_rect->h = canvas->h;
|
||||
api->playsound(blind_snd, (x * 255) / canvas->w, 255);
|
||||
break;
|
||||
|
||||
case BLIND_SIDE_LEFT:
|
||||
opaque = max((y * BLIND_THICKNESS) / canvas->h + 2, 2);
|
||||
for (i = x; i >= 0; i -= BLIND_THICKNESS)
|
||||
{
|
||||
blind_light = 255;
|
||||
for (j = i; j > i - opaque / 2; j--)
|
||||
{
|
||||
api->line(api, which, canvas, snapshot, j, 0, j, canvas->h, 1, blind_paint_blind);
|
||||
blind_light -= 20;
|
||||
}
|
||||
for (j = i - opaque / 2; j > i - opaque; j--)
|
||||
{
|
||||
api->line(api, which, canvas, snapshot, j, 0, j, canvas->h, 1, blind_paint_blind);
|
||||
blind_light += 20;
|
||||
}
|
||||
}
|
||||
update_rect->x = 0;
|
||||
update_rect->y = 0;
|
||||
update_rect->w = max(ox, x);
|
||||
update_rect->h = canvas->h;
|
||||
api->playsound(blind_snd, (x * 255) / canvas->w, 255);
|
||||
break;
|
||||
|
||||
blind_light = 255;
|
||||
for (j = i; j > i - opaque / 2; j--)
|
||||
{
|
||||
api->line(api, which, canvas, snapshot, 0, j, canvas->w, j, 1,
|
||||
blind_paint_blind);
|
||||
blind_light -= 20;
|
||||
}
|
||||
for (j = i - opaque / 2; j > i - opaque; j--)
|
||||
{
|
||||
api->line(api, which, canvas, snapshot, 0, j, canvas->w, j, 1,
|
||||
blind_paint_blind);
|
||||
blind_light += 20;
|
||||
}
|
||||
}
|
||||
update_rect->x = 0;
|
||||
update_rect->y = 0;
|
||||
update_rect->w = canvas->w;
|
||||
update_rect->h = max(oy, y);
|
||||
api->playsound(blind_snd, 128, 255);
|
||||
break;
|
||||
|
||||
case BLIND_SIDE_BOTTOM:
|
||||
opaque = max((x * BLIND_THICKNESS) / canvas->w + 2, 2);
|
||||
for (i = y; i <= canvas->h; i += BLIND_THICKNESS)
|
||||
{
|
||||
blind_light = 255;
|
||||
for (j = i; j < i + opaque / 2; j++)
|
||||
{
|
||||
api->line(api, which, canvas, snapshot, 0, j, canvas->w, j, 1,
|
||||
blind_paint_blind);
|
||||
blind_light -= 20;
|
||||
}
|
||||
for (j = i + opaque / 2; j < i + opaque; j++)
|
||||
{
|
||||
api->line(api, which, canvas, snapshot, 0, j, canvas->w, j, 1,
|
||||
blind_paint_blind);
|
||||
blind_light += 20;
|
||||
}
|
||||
}
|
||||
|
||||
update_rect->x = 0;
|
||||
update_rect->y = min(oy, y);
|
||||
update_rect->w = canvas->w;
|
||||
update_rect->h = canvas->h - update_rect->y;
|
||||
api->playsound(blind_snd, 128, 255);
|
||||
break;
|
||||
|
||||
case BLIND_SIDE_RIGHT:
|
||||
opaque = max((y * BLIND_THICKNESS) / canvas->h + 2, 2);
|
||||
for (i = x; i <= canvas->w; i += BLIND_THICKNESS)
|
||||
{
|
||||
blind_light = 255;
|
||||
for (j = i; j < i + opaque / 2; j++)
|
||||
{
|
||||
api->line(api, which, canvas, snapshot, j, 0, j, canvas->h, 1,
|
||||
blind_paint_blind);
|
||||
blind_light -= 20;
|
||||
}
|
||||
for (j = i + opaque / 2; j < i + opaque; j++)
|
||||
{
|
||||
api->line(api, which, canvas, snapshot, j, 0, j, canvas->h, 1,
|
||||
blind_paint_blind);
|
||||
blind_light += 20;
|
||||
}
|
||||
}
|
||||
|
||||
update_rect->x = min(ox, x);
|
||||
update_rect->y = 0;
|
||||
update_rect->w = canvas->w - update_rect->x;
|
||||
update_rect->h = canvas->h;
|
||||
api->playsound(blind_snd, (x * 255) / canvas->w, 255);
|
||||
break;
|
||||
|
||||
case BLIND_SIDE_LEFT:
|
||||
opaque = max((y * BLIND_THICKNESS) / canvas->h + 2, 2);
|
||||
for (i = x; i >= 0; i -= BLIND_THICKNESS)
|
||||
{
|
||||
blind_light = 255;
|
||||
for (j = i; j > i - opaque / 2; j--)
|
||||
{
|
||||
api->line(api, which, canvas, snapshot, j, 0, j, canvas->h, 1,
|
||||
blind_paint_blind);
|
||||
blind_light -= 20;
|
||||
}
|
||||
for (j = i - opaque / 2; j > i - opaque; j--)
|
||||
{
|
||||
api->line(api, which, canvas, snapshot, j, 0, j, canvas->h, 1,
|
||||
blind_paint_blind);
|
||||
blind_light += 20;
|
||||
}
|
||||
}
|
||||
update_rect->x = 0;
|
||||
update_rect->y = 0;
|
||||
update_rect->w = max(ox, x);
|
||||
update_rect->h = canvas->h;
|
||||
api->playsound(blind_snd, (x * 255) / canvas->w, 255);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
void blind_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)
|
||||
blind_side = BLIND_SIDE_LEFT;
|
||||
else if (canvas->w - x < y)
|
||||
blind_side = BLIND_SIDE_RIGHT;
|
||||
else
|
||||
blind_side = BLIND_SIDE_TOP;
|
||||
}
|
||||
{
|
||||
if (x < y)
|
||||
blind_side = BLIND_SIDE_LEFT;
|
||||
else if (canvas->w - x < y)
|
||||
blind_side = BLIND_SIDE_RIGHT;
|
||||
else
|
||||
blind_side = BLIND_SIDE_TOP;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (x < canvas->h - y)
|
||||
blind_side = BLIND_SIDE_LEFT;
|
||||
else if (canvas->w - x < canvas->h - y)
|
||||
blind_side = BLIND_SIDE_RIGHT;
|
||||
else
|
||||
blind_side = BLIND_SIDE_BOTTOM;
|
||||
}
|
||||
{
|
||||
if (x < canvas->h - y)
|
||||
blind_side = BLIND_SIDE_LEFT;
|
||||
else if (canvas->w - x < canvas->h - y)
|
||||
blind_side = BLIND_SIDE_RIGHT;
|
||||
else
|
||||
blind_side = BLIND_SIDE_BOTTOM;
|
||||
}
|
||||
|
||||
blind_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
||||
}
|
||||
|
||||
void blind_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
void blind_switchin(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void blind_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
void blind_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