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,19 +57,25 @@ char *puzzle_get_name(magic_api * api, int which);
|
|||
int puzzle_get_group(magic_api * api, int which);
|
||||
char *puzzle_get_description(magic_api * api, int which, int mode);
|
||||
void puzzle_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 puzzle_shutdown(magic_api * api);
|
||||
void puzzle_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int puzzle_requires_colors(magic_api * api, int which);
|
||||
void puzzle_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void puzzle_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void puzzle_switchin(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
void puzzle_switchout(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
int puzzle_modes(magic_api * api, int which);
|
||||
static void puzzle_draw(void *ptr, int which_tool, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y);
|
||||
static void puzzle_draw(void *ptr, int which_tool, SDL_Surface * canvas,
|
||||
SDL_Surface * snapshot, int x, int y);
|
||||
void puzzle_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 puzzle_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 gcd(int a, int b);
|
||||
|
||||
Uint32 puzzle_api_version(void)
|
||||
|
|
@ -81,7 +87,8 @@ int puzzle_init(magic_api * api)
|
|||
{
|
||||
char fname[1024];
|
||||
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/puzzle.wav", api->data_directory);
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/puzzle.wav",
|
||||
api->data_directory);
|
||||
puzzle_snd = Mix_LoadWAV(fname);
|
||||
|
||||
return 1;
|
||||
|
|
@ -96,32 +103,41 @@ SDL_Surface *puzzle_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
|||
{
|
||||
char fname[1024];
|
||||
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/puzzle.png", api->data_directory);
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/puzzle.png",
|
||||
api->data_directory);
|
||||
|
||||
return (IMG_Load(fname));
|
||||
}
|
||||
|
||||
char *puzzle_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
char *puzzle_get_name(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return (strdup(gettext_noop("Puzzle")));
|
||||
}
|
||||
|
||||
int puzzle_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
int puzzle_get_group(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return MAGIC_TYPE_DISTORTS;
|
||||
}
|
||||
|
||||
|
||||
char *puzzle_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode)
|
||||
char *puzzle_get_description(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, int mode)
|
||||
{
|
||||
if (mode == MODE_PAINT)
|
||||
return strdup(gettext_noop("Click the part of your picture where would you like a puzzle."));
|
||||
return
|
||||
strdup(gettext_noop
|
||||
("Click the part of your picture where would you like a puzzle."));
|
||||
return strdup(gettext_noop("Click to make a puzzle in fullscreen mode."));
|
||||
}
|
||||
|
||||
void puzzle_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 puzzle_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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -131,12 +147,14 @@ void puzzle_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
|||
Mix_FreeChunk(puzzle_snd);
|
||||
}
|
||||
|
||||
void puzzle_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED,
|
||||
void puzzle_set_color(magic_api * api ATTRIBUTE_UNUSED,
|
||||
Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED,
|
||||
Uint8 b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int puzzle_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
int puzzle_requires_colors(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -148,18 +166,22 @@ int gcd(int a, int b) //greatest common divisor
|
|||
return gcd(b, a % b);
|
||||
}
|
||||
|
||||
void puzzle_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
void puzzle_switchin(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas)
|
||||
{
|
||||
puzzle_gcd = RATIO * gcd(canvas->w, canvas->h);
|
||||
rects_w = (unsigned int)canvas->w / puzzle_gcd;
|
||||
rects_h = (unsigned int)canvas->h / puzzle_gcd;
|
||||
rects_w = (unsigned int) canvas->w / puzzle_gcd;
|
||||
rects_h = (unsigned int) canvas->h / puzzle_gcd;
|
||||
canvas_backup =
|
||||
SDL_CreateRGBSurface(SDL_SWSURFACE, canvas->w, canvas->h, canvas->format->BitsPerPixel, canvas->format->Rmask,
|
||||
canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
SDL_CreateRGBSurface(SDL_SWSURFACE, canvas->w, canvas->h,
|
||||
canvas->format->BitsPerPixel, canvas->format->Rmask,
|
||||
canvas->format->Gmask, canvas->format->Bmask,
|
||||
canvas->format->Amask);
|
||||
}
|
||||
|
||||
void puzzle_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
void puzzle_switchout(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
SDL_FreeSurface(canvas_backup);
|
||||
|
|
@ -172,7 +194,8 @@ int puzzle_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
|||
}
|
||||
|
||||
static void puzzle_draw(void *ptr, 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)
|
||||
{
|
||||
|
||||
|
||||
|
|
@ -187,59 +210,65 @@ static void puzzle_draw(void *ptr, int which_tool ATTRIBUTE_UNUSED,
|
|||
y = (y / puzzle_gcd) * puzzle_gcd;
|
||||
|
||||
if (!api->touched(x, y))
|
||||
{
|
||||
srand(rand());
|
||||
|
||||
r = rand() % 4;
|
||||
|
||||
rect_that.x = x;
|
||||
rect_that.y = y;
|
||||
|
||||
switch (r)
|
||||
{
|
||||
srand(rand());
|
||||
case 0: //upper
|
||||
if (y > puzzle_gcd)
|
||||
rect_that.y = y - puzzle_gcd;
|
||||
|
||||
r = rand() % 4;
|
||||
break;
|
||||
case 1: //right
|
||||
if (x < canvas->w - puzzle_gcd)
|
||||
rect_that.x = x - puzzle_gcd;
|
||||
|
||||
rect_that.x = x;
|
||||
rect_that.y = y;
|
||||
break;
|
||||
case 2: //lower
|
||||
if (y < canvas->h - puzzle_gcd)
|
||||
rect_that.y = y - puzzle_gcd;
|
||||
|
||||
switch (r)
|
||||
{
|
||||
case 0: //upper
|
||||
if (y > puzzle_gcd)
|
||||
rect_that.y = y - puzzle_gcd;
|
||||
|
||||
break;
|
||||
case 1: //right
|
||||
if (x < canvas->w - puzzle_gcd)
|
||||
rect_that.x = x - puzzle_gcd;
|
||||
|
||||
break;
|
||||
case 2: //lower
|
||||
if (y < canvas->h - puzzle_gcd)
|
||||
rect_that.y = y - puzzle_gcd;
|
||||
|
||||
break;
|
||||
case 3: //left
|
||||
if (x > puzzle_gcd)
|
||||
rect_that.x = x - puzzle_gcd;
|
||||
break;
|
||||
}
|
||||
|
||||
rect_this.x = x;
|
||||
rect_this.y = y;
|
||||
rect_this.h = rect_this.w = puzzle_gcd;
|
||||
rect_that.h = rect_that.w = puzzle_gcd;
|
||||
|
||||
|
||||
SDL_BlitSurface(canvas, &rect_this, canvas, &rect_that);
|
||||
SDL_BlitSurface(canvas_backup, &rect_that, canvas, &rect_this);
|
||||
api->playsound(puzzle_snd, (x * 255) / canvas->w, 255);
|
||||
break;
|
||||
case 3: //left
|
||||
if (x > puzzle_gcd)
|
||||
rect_that.x = x - puzzle_gcd;
|
||||
break;
|
||||
}
|
||||
|
||||
rect_this.x = x;
|
||||
rect_this.y = y;
|
||||
rect_this.h = rect_this.w = puzzle_gcd;
|
||||
rect_that.h = rect_that.w = puzzle_gcd;
|
||||
|
||||
|
||||
SDL_BlitSurface(canvas, &rect_this, canvas, &rect_that);
|
||||
SDL_BlitSurface(canvas_backup, &rect_that, canvas, &rect_this);
|
||||
api->playsound(puzzle_snd, (x * 255) / canvas->w, 255);
|
||||
}
|
||||
}
|
||||
|
||||
void puzzle_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED, int x, int y,
|
||||
SDL_Surface * last, int ox ATTRIBUTE_UNUSED,
|
||||
int oy ATTRIBUTE_UNUSED, int x, int y,
|
||||
SDL_Rect * update_rect)
|
||||
{
|
||||
puzzle_draw(api, which, canvas, last, x - puzzle_gcd / 2, y - puzzle_gcd / 2);
|
||||
puzzle_draw(api, which, canvas, last, x - puzzle_gcd / 2,
|
||||
y - puzzle_gcd / 2);
|
||||
|
||||
puzzle_draw(api, which, canvas, last, x - 1.5 * puzzle_gcd / 2, y - puzzle_gcd / 2);
|
||||
puzzle_draw(api, which, canvas, last, x + 0.5 * puzzle_gcd, y - puzzle_gcd / 2);
|
||||
puzzle_draw(api, which, canvas, last, x - puzzle_gcd / 2, y - 1.5 * puzzle_gcd);
|
||||
puzzle_draw(api, which, canvas, last, x - puzzle_gcd / 2, y + 0.5 * puzzle_gcd);
|
||||
puzzle_draw(api, which, canvas, last, x - 1.5 * puzzle_gcd / 2,
|
||||
y - puzzle_gcd / 2);
|
||||
puzzle_draw(api, which, canvas, last, x + 0.5 * puzzle_gcd,
|
||||
y - puzzle_gcd / 2);
|
||||
puzzle_draw(api, which, canvas, last, x - puzzle_gcd / 2,
|
||||
y - 1.5 * puzzle_gcd);
|
||||
puzzle_draw(api, which, canvas, last, x - puzzle_gcd / 2,
|
||||
y + 0.5 * puzzle_gcd);
|
||||
|
||||
update_rect->x = 0;
|
||||
update_rect->y = 0;
|
||||
|
|
@ -248,7 +277,8 @@ void puzzle_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
}
|
||||
|
||||
void puzzle_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)
|
||||
{
|
||||
puzzle_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue