indent metalpaint.c

This commit is contained in:
Bill Kendrick 2017-10-15 11:47:37 -07:00
parent 7e524f44ad
commit 800d8af3b7

View file

@ -44,17 +44,13 @@ int metalpaint_get_tool_count(magic_api * api);
SDL_Surface *metalpaint_get_icon(magic_api * api, int which); SDL_Surface *metalpaint_get_icon(magic_api * api, int which);
char *metalpaint_get_name(magic_api * api, int which); char *metalpaint_get_name(magic_api * api, int which);
char *metalpaint_get_description(magic_api * api, int which, int mode); char *metalpaint_get_description(magic_api * api, int which, int mode);
static void do_metalpaint(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last, static void do_metalpaint(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
int x, int y);
void metalpaint_drag(magic_api * api, int which, SDL_Surface * canvas, void metalpaint_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect);
SDL_Rect * update_rect);
void metalpaint_click(magic_api * api, int which, int mode, void metalpaint_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
int x, int y, SDL_Rect * update_rect);
void metalpaint_release(magic_api * api, int which, void metalpaint_release(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect);
int x, int y, SDL_Rect * update_rect);
void metalpaint_shutdown(magic_api * api); void metalpaint_shutdown(magic_api * api);
void metalpaint_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b); void metalpaint_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
int metalpaint_requires_colors(magic_api * api, int which); int metalpaint_requires_colors(magic_api * api, int which);
@ -63,7 +59,10 @@ void metalpaint_switchout(magic_api * api, int which, int mode, SDL_Surface * ca
int metalpaint_modes(magic_api * api, int which); int metalpaint_modes(magic_api * api, int which);
Uint32 metalpaint_api_version(void) { return(TP_MAGIC_API_VERSION); } Uint32 metalpaint_api_version(void)
{
return (TP_MAGIC_API_VERSION);
}
// No setup required: // No setup required:
@ -71,8 +70,7 @@ int metalpaint_init(magic_api * api)
{ {
char fname[1024]; char fname[1024];
snprintf(fname, sizeof(fname), "%s/sounds/magic/metalpaint.wav", snprintf(fname, sizeof(fname), "%s/sounds/magic/metalpaint.wav", api->data_directory);
api->data_directory);
metalpaint_snd = Mix_LoadWAV(fname); metalpaint_snd = Mix_LoadWAV(fname);
return (1); return (1);
@ -89,8 +87,7 @@ SDL_Surface * metalpaint_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
{ {
char fname[1024]; char fname[1024];
snprintf(fname, sizeof(fname), "%s/images/magic/metalpaint.png", snprintf(fname, sizeof(fname), "%s/images/magic/metalpaint.png", api->data_directory);
api->data_directory);
return (IMG_Load(fname)); return (IMG_Load(fname));
} }
@ -102,7 +99,8 @@ char * metalpaint_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE
} }
// Return our descriptions, localized: // Return our descriptions, localized:
char * metalpaint_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) char *metalpaint_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
int mode ATTRIBUTE_UNUSED)
{ {
return (strdup(gettext_noop("Click and drag the mouse to paint with a metallic color."))); return (strdup(gettext_noop("Click and drag the mouse to paint with a metallic color.")));
} }
@ -120,8 +118,8 @@ static int metalpaint_gradient[METALPAINT_CYCLE] = {
// Do the effect: // Do the effect:
static void do_metalpaint(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED, static void do_metalpaint(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas,
int x, int y) SDL_Surface * last ATTRIBUTE_UNUSED, int x, int y)
{ {
magic_api *api = (magic_api *) ptr; magic_api *api = (magic_api *) ptr;
int xx, yy; int xx, yy;
@ -145,13 +143,24 @@ static void do_metalpaint(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface *
// Affect the canvas on drag: // Affect the canvas on drag:
void metalpaint_drag(magic_api * api, int which, SDL_Surface * canvas, void metalpaint_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y, SDL_Surface * last, int ox, int oy, int x, int y, SDL_Rect * update_rect)
SDL_Rect * update_rect)
{ {
api->line((void *)api, which, canvas, last, ox, oy, x, y, 1, do_metalpaint); api->line((void *)api, which, canvas, last, ox, oy, x, y, 1, do_metalpaint);
if (ox > x) { int tmp = ox; ox = x; x = tmp; } if (ox > x)
if (oy > y) { int tmp = oy; oy = y; y = tmp; } {
int tmp = ox;
ox = x;
x = tmp;
}
if (oy > y)
{
int tmp = oy;
oy = y;
y = tmp;
}
update_rect->x = ox - 8; update_rect->x = ox - 8;
update_rect->y = oy - 8; update_rect->y = oy - 8;
@ -163,8 +172,7 @@ void metalpaint_drag(magic_api * api, int which, SDL_Surface * canvas,
// Affect the canvas on click: // Affect the canvas on click:
void metalpaint_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED, void metalpaint_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last, int x, int y, SDL_Rect * update_rect)
int x, int y, SDL_Rect * update_rect)
{ {
metalpaint_drag(api, which, canvas, last, x, y, x, y, update_rect); metalpaint_drag(api, which, canvas, last, x, y, x, y, update_rect);
} }
@ -197,11 +205,13 @@ int metalpaint_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRI
return 1; return 1;
} }
void metalpaint_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED) void metalpaint_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED)
{ {
} }
void metalpaint_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED) void metalpaint_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED)
{ {
} }