indent light.c

This commit is contained in:
Bill Kendrick 2017-10-15 11:47:27 -07:00
parent e146c3df38
commit 7e524f44ad

View file

@ -46,17 +46,13 @@ int light_get_tool_count(magic_api * api);
SDL_Surface *light_get_icon(magic_api * api, int which);
char *light_get_name(magic_api * api, int which);
char *light_get_description(magic_api * api, int which, int mode);
static void do_light(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
int x, int y);
static void do_light(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
void light_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 light_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);
void light_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 light_shutdown(magic_api * api);
void light_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
int light_requires_colors(magic_api * api, int which);
@ -65,7 +61,10 @@ void light_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
int light_modes(magic_api * api, int which);
Uint32 light_api_version(void) { return(TP_MAGIC_API_VERSION); }
Uint32 light_api_version(void)
{
return (TP_MAGIC_API_VERSION);
}
// No setup required:
@ -73,12 +72,10 @@ int light_init(magic_api * api)
{
char fname[1024];
snprintf(fname, sizeof(fname), "%s/sounds/magic/light1.ogg",
api->data_directory);
snprintf(fname, sizeof(fname), "%s/sounds/magic/light1.ogg", api->data_directory);
light1_snd = Mix_LoadWAV(fname);
snprintf(fname, sizeof(fname), "%s/sounds/magic/light2.ogg",
api->data_directory);
snprintf(fname, sizeof(fname), "%s/sounds/magic/light2.ogg", api->data_directory);
light2_snd = Mix_LoadWAV(fname);
return (1);
@ -95,8 +92,7 @@ SDL_Surface * light_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
{
char fname[1024];
snprintf(fname, sizeof(fname), "%s/images/magic/light.png",
api->data_directory);
snprintf(fname, sizeof(fname), "%s/images/magic/light.png", api->data_directory);
return (IMG_Load(fname));
}
@ -168,8 +164,7 @@ static void do_light(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canva
api->hsvtorgb(new_h, new_s, new_v, &r, &g, &b);
api->putpixel(canvas, x + xx, y + yy,
SDL_MapRGB(canvas->format, r, g, b));
api->putpixel(canvas, x + xx, y + yy, SDL_MapRGB(canvas->format, r, g, b));
}
}
}
@ -177,13 +172,24 @@ static void do_light(void * ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canva
// Affect the canvas on drag:
void light_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, do_light);
if (ox > x) { int tmp = ox; ox = x; x = tmp; }
if (oy > y) { int tmp = oy; oy = y; y = tmp; }
if (ox > x)
{
int tmp = ox;
ox = x;
x = tmp;
}
if (oy > y)
{
int tmp = oy;
oy = y;
y = tmp;
}
update_rect->x = ox - 8;
update_rect->y = oy - 8;
@ -195,8 +201,7 @@ void light_drag(magic_api * api, int which, SDL_Surface * canvas,
// Affect the canvas on click:
void light_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)
{
light_drag(api, which, canvas, last, x, y, x, y, update_rect);
}
@ -230,11 +235,13 @@ int light_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_
return 1;
}
void light_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
void light_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED)
{
}
void light_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
void light_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED)
{
}