Address tons of warnings in magic/src/lightning.c
This commit is contained in:
parent
d27c21bf2a
commit
5f9ff7e97d
1 changed files with 36 additions and 19 deletions
|
|
@ -3,7 +3,7 @@
|
||||||
Draws a lightning strike between the click
|
Draws a lightning strike between the click
|
||||||
and drag+release positions.
|
and drag+release positions.
|
||||||
|
|
||||||
Last modified: 2021.09.27
|
Last modified: 2021.10.24
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
@ -20,10 +20,27 @@ float lightning_h, lightning_s, lightning_v;
|
||||||
int sx, sy;
|
int sx, sy;
|
||||||
|
|
||||||
|
|
||||||
|
Uint32 lightning_api_version(void);
|
||||||
|
int lightning_init(magic_api * api);
|
||||||
|
int lightning_get_tool_count(magic_api * api);
|
||||||
|
SDL_Surface *lightning_get_icon(magic_api * api, int which);
|
||||||
|
char *lightning_get_name(magic_api * api, int which);
|
||||||
|
int lightning_get_group(magic_api * api, int which);
|
||||||
|
char *lightning_get_description(magic_api * api, int which, int mode);
|
||||||
|
int lightning_requires_colors(magic_api * api, int which);
|
||||||
|
int lightning_modes(magic_api * api, int which);
|
||||||
|
void lightning_shutdown(magic_api * api);
|
||||||
|
void lightning_click(magic_api * api, int which, int mode,
|
||||||
|
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect);
|
||||||
|
void lightning_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||||
void lightning_drag(magic_api * api, int which, SDL_Surface * canvas,
|
void lightning_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||||
SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Rect * update_rect);
|
SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Rect * update_rect);
|
||||||
void lightning_line_callback_drag(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y);
|
void lightning_line_callback_drag(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y);
|
||||||
void lightning_draw_bolt(void * ptr, SDL_Surface * canvas, SDL_Surface * snapshot, float sx, float sy, float angle, float len, int thickness);
|
void lightning_draw_bolt(void * ptr, SDL_Surface * canvas, SDL_Surface * snapshot, float sx, float sy, float angle, float len, int thickness);
|
||||||
|
void lightning_release(magic_api * api, int which,
|
||||||
|
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect);
|
||||||
|
void lightning_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||||
|
void lightning_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||||
|
|
||||||
|
|
||||||
Uint32 lightning_api_version(void)
|
Uint32 lightning_api_version(void)
|
||||||
|
|
@ -41,13 +58,13 @@ int lightning_init(magic_api * api)
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
int lightning_get_tool_count(magic_api * api)
|
int lightning_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
return (1);
|
return (1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
SDL_Surface *lightning_get_icon(magic_api * api, int which)
|
SDL_Surface *lightning_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
char fname[1024];
|
char fname[1024];
|
||||||
|
|
||||||
|
|
@ -56,32 +73,32 @@ SDL_Surface *lightning_get_icon(magic_api * api, int which)
|
||||||
return (IMG_Load(fname));
|
return (IMG_Load(fname));
|
||||||
}
|
}
|
||||||
|
|
||||||
char *lightning_get_name(magic_api * api, int which)
|
char *lightning_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
return strdup(gettext("Lightning"));
|
return strdup(gettext("Lightning"));
|
||||||
}
|
}
|
||||||
|
|
||||||
int lightning_get_group(magic_api * api, int which)
|
int lightning_get_group(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
return MAGIC_TYPE_ARTISTIC;
|
return MAGIC_TYPE_ARTISTIC;
|
||||||
}
|
}
|
||||||
|
|
||||||
char *lightning_get_description(magic_api * api, int which, int mode)
|
char *lightning_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
return strdup(gettext("Click, drag, and release to a lightning bolt between two points."));
|
return strdup(gettext("Click, drag, and release to a lightning bolt between two points."));
|
||||||
}
|
}
|
||||||
|
|
||||||
int lightning_requires_colors(magic_api * api, int which)
|
int lightning_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int lightning_modes(magic_api * api, int which)
|
int lightning_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
return MODE_PAINT;
|
return MODE_PAINT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void lightning_shutdown(magic_api * api)
|
void lightning_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
if (snd_effect != NULL)
|
if (snd_effect != NULL)
|
||||||
Mix_FreeChunk(snd_effect);
|
Mix_FreeChunk(snd_effect);
|
||||||
|
|
@ -89,7 +106,7 @@ void lightning_shutdown(magic_api * api)
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
lightning_click(magic_api * api, int which, int mode,
|
lightning_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||||
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect)
|
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect)
|
||||||
{
|
{
|
||||||
sx = x;
|
sx = x;
|
||||||
|
|
@ -100,7 +117,8 @@ lightning_click(magic_api * api, int which, int mode,
|
||||||
|
|
||||||
void
|
void
|
||||||
lightning_drag(magic_api * api, int which, SDL_Surface * canvas,
|
lightning_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||||
SDL_Surface * snapshot, int ox, int oy, int x, int y, SDL_Rect * update_rect)
|
SDL_Surface * snapshot, int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED,
|
||||||
|
int x, int y, SDL_Rect * update_rect)
|
||||||
{
|
{
|
||||||
/* FIXME: This could be made more efficient
|
/* FIXME: This could be made more efficient
|
||||||
(only blit and update between (sx,sy) and (x,y), though
|
(only blit and update between (sx,sy) and (x,y), though
|
||||||
|
|
@ -118,7 +136,7 @@ lightning_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
lightning_release(magic_api * api, int which,
|
lightning_release(magic_api * api, int which ATTRIBUTE_UNUSED,
|
||||||
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect)
|
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Rect * update_rect)
|
||||||
{
|
{
|
||||||
float a, b, len, angle;
|
float a, b, len, angle;
|
||||||
|
|
@ -166,9 +184,9 @@ void lightning_draw_bolt(void * ptr, SDL_Surface * canvas, SDL_Surface * snapsho
|
||||||
{
|
{
|
||||||
magic_api *api = (magic_api *) ptr;
|
magic_api *api = (magic_api *) ptr;
|
||||||
float i;
|
float i;
|
||||||
float x, y, orig_angle, pct;
|
float x, y, orig_angle;
|
||||||
int xx, yy, t;
|
int xx, yy, t;
|
||||||
Uint8 r, g, b, or, og, ob;
|
Uint8 r, g, b;
|
||||||
float h, s, v, new_h, new_s, new_v;
|
float h, s, v, new_h, new_s, new_v;
|
||||||
float adj;
|
float adj;
|
||||||
|
|
||||||
|
|
@ -197,11 +215,10 @@ void lightning_draw_bolt(void * ptr, SDL_Surface * canvas, SDL_Surface * snapsho
|
||||||
{
|
{
|
||||||
if (api->in_circle(xx, yy, t))
|
if (api->in_circle(xx, yy, t))
|
||||||
{
|
{
|
||||||
float light_h, light_s, light_v;
|
float light_h, light_s;
|
||||||
|
|
||||||
light_h = lightning_h;
|
light_h = lightning_h;
|
||||||
light_s = lightning_s;
|
light_s = lightning_s;
|
||||||
light_v = lightning_v;
|
|
||||||
|
|
||||||
SDL_GetRGB(api->getpixel(canvas, x + xx, y + yy), canvas->format, &r, &g, &b);
|
SDL_GetRGB(api->getpixel(canvas, x + xx, y + yy), canvas->format, &r, &g, &b);
|
||||||
api->rgbtohsv(r, g, b, &h, &s, &v);
|
api->rgbtohsv(r, g, b, &h, &s, &v);
|
||||||
|
|
@ -262,17 +279,17 @@ void lightning_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void lightning_line_callback_drag(void *ptr, int which, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y)
|
void lightning_line_callback_drag(void *ptr, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED, int x, int y)
|
||||||
{
|
{
|
||||||
magic_api *api = (magic_api *) ptr;
|
magic_api *api = (magic_api *) ptr;
|
||||||
|
|
||||||
api->xorpixel(canvas, x, y);
|
api->xorpixel(canvas, x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
void lightning_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
void lightning_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
void lightning_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
void lightning_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue