indent tv.c

This commit is contained in:
Bill Kendrick 2017-10-15 11:51:18 -07:00
parent 011f7f27c1
commit cc7dd8e3c9

View file

@ -43,19 +43,14 @@ char * tv_get_name(magic_api * api, int which);
char *tv_get_description(magic_api * api, int which, int mode); char *tv_get_description(magic_api * api, int which, int mode);
int tv_requires_colors(magic_api * api, int which); int tv_requires_colors(magic_api * api, int which);
void tv_release(magic_api * api, int which, void tv_release(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * snapshot, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect);
int x, int y, SDL_Rect * update_rect);
void tv_shutdown(magic_api * api); void tv_shutdown(magic_api * api);
void tv_paint_tv(void * ptr_to_api, int which_tool, void tv_paint_tv(void *ptr_to_api, int which_tool, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y);
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y); void tv_do_tv(void *ptr_to_api, int which_tool, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y);
void tv_do_tv(void * ptr_to_api, int which_tool,
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y);
void tv_drag(magic_api * api, int which, SDL_Surface * canvas, void tv_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Rect * update_rect);
SDL_Rect * update_rect);
void tv_click(magic_api * api, int which, int mode, void tv_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 tv_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas); void tv_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
void tv_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas); void tv_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
int tv_modes(magic_api * api, int which); int tv_modes(magic_api * api, int which);
@ -91,13 +86,15 @@ SDL_Surface * tv_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
{ {
char fname[1024]; char fname[1024];
snprintf(fname, sizeof(fname), "%s/images/magic/tv.png", snprintf(fname, sizeof(fname), "%s/images/magic/tv.png", api->data_directory);
api->data_directory);
return (IMG_Load(fname)); return (IMG_Load(fname));
} }
char * tv_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) { return strdup(gettext_noop("TV")); } char *tv_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return strdup(gettext_noop("TV"));
}
char *tv_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode) char *tv_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode)
{ {
@ -109,7 +106,10 @@ char * tv_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE
} }
int tv_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) { return 0; } int tv_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return 0;
}
void tv_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, void tv_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * snapshot ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * snapshot ATTRIBUTE_UNUSED,
@ -118,7 +118,9 @@ void tv_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
} }
void tv_shutdown(magic_api * api ATTRIBUTE_UNUSED) void tv_shutdown(magic_api * api ATTRIBUTE_UNUSED)
{ Mix_FreeChunk(tv_snd); } {
Mix_FreeChunk(tv_snd);
}
// Interactivity functions // Interactivity functions
@ -130,9 +132,7 @@ void tv_paint_tv(void * ptr_to_api, int which_tool ATTRIBUTE_UNUSED,
for (i = x - RADIUS; i < x + RADIUS; i++) for (i = x - RADIUS; i < x + RADIUS; i++)
for (j = y - RADIUS; j < y + RADIUS; j++) for (j = y - RADIUS; j < y + RADIUS; j++)
if ((j + 1) % 2 && if ((j + 1) % 2 && api->in_circle(i - x, j - y, RADIUS) && !api->touched(i, j))
api->in_circle(i - x, j - y, RADIUS) &&
! api->touched(i, j))
api->putpixel(canvas, i, j, SDL_MapRGB(canvas->format, 128, 128, 165)); api->putpixel(canvas, i, j, SDL_MapRGB(canvas->format, 128, 128, 165));
} }
@ -146,8 +146,7 @@ void tv_do_tv(void * ptr_to_api, int which_tool ATTRIBUTE_UNUSED,
} }
void tv_drag(magic_api * api, int which, SDL_Surface * canvas, void tv_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Rect * update_rect)
SDL_Rect * update_rect)
{ {
api->line(api, which, canvas, snapshot, ox, oy, x, y, 1, tv_paint_tv); api->line(api, which, canvas, snapshot, ox, oy, x, y, 1, tv_paint_tv);
@ -159,8 +158,7 @@ void tv_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
void tv_click(magic_api * api, int which, int mode, void tv_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)
{ {
if (mode == MODE_FULLSCREEN) if (mode == MODE_FULLSCREEN)
{ {
@ -180,12 +178,14 @@ void tv_click(magic_api * api, int which, int mode,
} }
} }
void tv_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED) void tv_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED)
{ {
} }
void tv_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED) void tv_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED)
{ {
} }