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
|
|
@ -42,8 +42,7 @@
|
|||
#define gettext_noop(String) String
|
||||
#endif
|
||||
|
||||
void rain_click(magic_api *, int, int, SDL_Surface *, SDL_Surface *, int, int,
|
||||
SDL_Rect *);
|
||||
void rain_click(magic_api *, int, int, SDL_Surface *, SDL_Surface *, int, int, SDL_Rect *);
|
||||
|
||||
static int rain_SIZE = 30;
|
||||
static int rain_AMOUNT = 200;
|
||||
|
|
@ -84,13 +83,10 @@ SDL_Surface *rain_get_icon(magic_api * api, int which);
|
|||
char *rain_get_name(magic_api * api, int which);
|
||||
int rain_get_group(magic_api * api, int which);
|
||||
char *rain_get_description(magic_api * api, int which, int mode);
|
||||
static void do_rain_drop(void *ptr, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y);
|
||||
static void rain_linecb(void *ptr, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y);
|
||||
static void do_rain_drop(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
|
||||
static void rain_linecb(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
|
||||
void rain_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 rain_click(magic_api * api, int which, int mode, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
|
||||
void rain_release(magic_api * api, int which, SDL_Surface * canvas,
|
||||
|
|
@ -99,14 +95,13 @@ void rain_shutdown(magic_api * api);
|
|||
void rain_set_color(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect);
|
||||
int rain_requires_colors(magic_api * api, int which);
|
||||
void rain_switchin(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
void rain_switchout(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas);
|
||||
void rain_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void rain_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int rain_modes(magic_api * api, int which);
|
||||
Uint8 rain_accepted_sizes(magic_api * api, int which, int mode);
|
||||
Uint8 rain_default_size(magic_api * api, int which, int mode);
|
||||
void rain_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect);
|
||||
void rain_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size,
|
||||
SDL_Rect * update_rect);
|
||||
|
||||
|
||||
Uint32 rain_api_version(void)
|
||||
|
|
@ -117,7 +112,7 @@ Uint32 rain_api_version(void)
|
|||
//Checks if a a pixel is inside a raindrop shape centered on the origin
|
||||
static int rain_inRainShape(double x, double y, double r)
|
||||
{
|
||||
if (sqrt(x * x + y * y) < (r * pow(cos(atan2(x, y)), (float) (rain_SIZE / 3.0))))
|
||||
if (sqrt(x * x + y * y) < (r * pow(cos(atan2(x, y)), (float)(rain_SIZE / 3.0))))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
|
@ -133,8 +128,7 @@ int rain_init(magic_api * api, Uint32 disabled_features ATTRIBUTE_UNUSED)
|
|||
//Load sounds
|
||||
for (i = 0; i < rain_NUM_TOOLS; i++)
|
||||
{
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/%s", api->data_directory,
|
||||
rain_snd_filenames[i]);
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/%s", api->data_directory, rain_snd_filenames[i]);
|
||||
rain_snd_effect[i] = Mix_LoadWAV(fname);
|
||||
}
|
||||
|
||||
|
|
@ -151,8 +145,7 @@ SDL_Surface *rain_get_icon(magic_api * api, int which)
|
|||
{
|
||||
char fname[1024];
|
||||
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/%s", api->data_directory,
|
||||
rain_icon_filenames[which]);
|
||||
snprintf(fname, sizeof(fname), "%simages/magic/%s", api->data_directory, rain_icon_filenames[which]);
|
||||
return (IMG_Load(fname));
|
||||
}
|
||||
|
||||
|
|
@ -169,16 +162,14 @@ int rain_get_group(magic_api * api ATTRIBUTE_UNUSED, int which)
|
|||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char *rain_get_description(magic_api * api ATTRIBUTE_UNUSED, int which,
|
||||
int mode)
|
||||
char *rain_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode)
|
||||
{
|
||||
return (strdup(gettext_noop(rain_descs[which][mode - 1])));
|
||||
}
|
||||
|
||||
// Do the effect:
|
||||
static void do_rain_drop(void *ptr, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas,
|
||||
SDL_Surface * last ATTRIBUTE_UNUSED, int x, int y)
|
||||
SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED, int x, int y)
|
||||
{
|
||||
magic_api *api = (magic_api *) ptr;
|
||||
|
||||
|
|
@ -195,17 +186,14 @@ static void do_rain_drop(void *ptr, int which ATTRIBUTE_UNUSED,
|
|||
//api->hsvtorgb(h, s, rain_weights[(yy-y)*((rain_SIZE*2) -1)+(xx-x)], &r, &g, &b);
|
||||
SDL_GetRGB(api->getpixel(canvas, xx, yy), canvas->format, &r, &g, &b);
|
||||
api->putpixel(canvas, xx, yy,
|
||||
SDL_MapRGB(canvas->format, clamp(0, r - 50, 255),
|
||||
clamp(0, g - 50, 255), clamp(0, b + 200,
|
||||
255)));
|
||||
SDL_MapRGB(canvas->format, clamp(0, r - 50, 255), clamp(0, g - 50, 255), clamp(0, b + 200, 255)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void rain_linecb(void *ptr, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int x, int y)
|
||||
static void rain_linecb(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y)
|
||||
{
|
||||
magic_api *api = (magic_api *) ptr;
|
||||
SDL_Rect rect;
|
||||
|
|
@ -213,17 +201,15 @@ static void rain_linecb(void *ptr, int which, SDL_Surface * canvas,
|
|||
if (rand() % 10 == 0)
|
||||
{
|
||||
rain_click(api, which, MODE_PAINT, canvas, last,
|
||||
x + (rand() % rain_SIZE * 2) - rain_SIZE,
|
||||
y + (rand() % rain_SIZE * 2) - rain_SIZE, &rect);
|
||||
x + (rand() % rain_SIZE * 2) - rain_SIZE, y + (rand() % rain_SIZE * 2) - rain_SIZE, &rect);
|
||||
}
|
||||
}
|
||||
|
||||
// Affect the canvas on drag:
|
||||
void rain_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, rain_linecb);
|
||||
api->line((void *)api, which, canvas, last, ox, oy, x, y, 1, rain_linecb);
|
||||
|
||||
if (ox > x)
|
||||
{
|
||||
|
|
@ -248,8 +234,7 @@ void rain_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
|
||||
// Affect the canvas on click:
|
||||
void rain_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_PAINT)
|
||||
|
|
@ -270,8 +255,7 @@ void rain_click(magic_api * api, int which, int mode,
|
|||
|
||||
for (i = 0; i < rain_AMOUNT; i++)
|
||||
{
|
||||
do_rain_drop(api, which, canvas, last, rand() % canvas->w,
|
||||
rand() % canvas->h);
|
||||
do_rain_drop(api, which, canvas, last, rand() % canvas->w, rand() % canvas->h);
|
||||
}
|
||||
|
||||
update_rect->x = 0;
|
||||
|
|
@ -288,8 +272,7 @@ void rain_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 y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -310,27 +293,25 @@ void rain_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
|||
|
||||
// Record the color from Tux Paint:
|
||||
void rain_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)
|
||||
SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED,
|
||||
Uint8 b ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// Use colors:
|
||||
int rain_requires_colors(magic_api * api ATTRIBUTE_UNUSED,
|
||||
int which ATTRIBUTE_UNUSED)
|
||||
int rain_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
void rain_switchin(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)
|
||||
{
|
||||
}
|
||||
|
||||
void rain_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)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -351,7 +332,9 @@ Uint8 rain_default_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UN
|
|||
return 2;
|
||||
}
|
||||
|
||||
void rain_set_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 size, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
void rain_set_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 size,
|
||||
SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
rain_SIZE = size * 15;
|
||||
rain_AMOUNT = 400 / size;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue