Adding "indent.sh" to re-indent code; ran it!!!
This commit is contained in:
parent
16336cc854
commit
18f9cad6fe
98 changed files with 5798 additions and 9001 deletions
|
|
@ -57,30 +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, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect);
|
||||
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);
|
||||
Uint8 puzzle_accepted_sizes(magic_api * api, int which, int mode);
|
||||
Uint8 puzzle_default_size(magic_api * api, int which, int mode);
|
||||
void puzzle_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect);
|
||||
void puzzle_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size,
|
||||
SDL_Rect * update_rect);
|
||||
|
||||
Uint32 puzzle_api_version(void)
|
||||
{
|
||||
|
|
@ -91,8 +86,7 @@ int puzzle_init(magic_api * api, Uint32 disabled_features ATTRIBUTE_UNUSED)
|
|||
{
|
||||
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;
|
||||
|
|
@ -107,32 +101,26 @@ 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."));
|
||||
}
|
||||
|
||||
|
|
@ -140,8 +128,7 @@ 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)
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -151,13 +138,14 @@ void puzzle_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
|||
Mix_FreeChunk(puzzle_snd);
|
||||
}
|
||||
|
||||
void puzzle_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
void puzzle_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED,
|
||||
SDL_Rect * update_rect 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;
|
||||
}
|
||||
|
|
@ -170,22 +158,19 @@ int gcd(int a, int b) //greatest common divisor
|
|||
}
|
||||
|
||||
void puzzle_switchin(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas)
|
||||
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);
|
||||
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,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
SDL_FreeSurface(canvas_backup);
|
||||
canvas_backup = NULL;
|
||||
|
|
@ -197,8 +182,7 @@ 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)
|
||||
{
|
||||
|
||||
|
||||
|
|
@ -258,20 +242,14 @@ static void puzzle_draw(void *ptr, int which_tool ATTRIBUTE_UNUSED,
|
|||
|
||||
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_Rect * update_rect)
|
||||
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;
|
||||
|
|
@ -280,8 +258,7 @@ 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);
|
||||
}
|
||||
|
|
@ -297,9 +274,9 @@ Uint8 puzzle_default_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_
|
|||
return 4;
|
||||
}
|
||||
|
||||
void puzzle_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 size, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
void puzzle_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
Uint8 size, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
RATIO = size + 1;
|
||||
puzzle_switchin(api, which, mode, canvas);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue