Removing warnings in half of magic tools by some GCI students.
This commit is contained in:
parent
5a85cef991
commit
0a2072e334
24 changed files with 924 additions and 377 deletions
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
grass.c
|
||||
grass.c
|
||||
|
||||
Grass Magic Tool Plugin
|
||||
Tux Paint - A simple drawing program for children.
|
||||
|
|
@ -41,14 +41,32 @@ static Mix_Chunk * grass_snd;
|
|||
static Uint8 grass_r, grass_g, grass_b;
|
||||
static SDL_Surface * img_grass;
|
||||
|
||||
|
||||
/* Local prototypes: */
|
||||
|
||||
// Prototypes
|
||||
int grass_init(magic_api * api);
|
||||
Uint32 grass_api_version(void);
|
||||
int grass_get_tool_count(magic_api * api);
|
||||
SDL_Surface * grass_get_icon(magic_api * api, int which);
|
||||
char * grass_get_name(magic_api * api, int which);
|
||||
char * grass_get_description(magic_api * api, int which, int mode);
|
||||
void grass_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
SDL_Rect * update_rect);
|
||||
void grass_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void grass_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void grass_shutdown(magic_api * api);
|
||||
void grass_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int grass_requires_colors(magic_api * api, int which);
|
||||
static void do_grass(void * ptr, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y);
|
||||
|
||||
static int log2int(int x);
|
||||
void grass_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void grass_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int grass_modes(magic_api * api, int which);
|
||||
|
||||
|
||||
// No setup required:
|
||||
|
|
@ -67,16 +85,18 @@ int grass_init(magic_api * api)
|
|||
return(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Uint32 grass_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||
|
||||
// We have multiple tools:
|
||||
int grass_get_tool_count(magic_api * api)
|
||||
int grass_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
|
||||
// Load our icons:
|
||||
SDL_Surface * grass_get_icon(magic_api * api, int which)
|
||||
SDL_Surface * grass_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char fname[1024];
|
||||
|
||||
|
|
@ -87,13 +107,13 @@ SDL_Surface * grass_get_icon(magic_api * api, int which)
|
|||
}
|
||||
|
||||
// Return our names, localized:
|
||||
char * grass_get_name(magic_api * api, int which)
|
||||
char * grass_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Grass")));
|
||||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char * grass_get_description(magic_api * api, int which, int mode)
|
||||
char * grass_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Click and move to draw grass. Don’t forget the dirt!")));
|
||||
}
|
||||
|
|
@ -119,28 +139,28 @@ void grass_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
}
|
||||
|
||||
// Affect the canvas on click:
|
||||
void grass_click(magic_api * api, int which, int mode,
|
||||
void grass_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
grass_drag(api, which, canvas, last, x, y, x, y, update_rect);
|
||||
}
|
||||
|
||||
void grass_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void grass_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)
|
||||
{
|
||||
}
|
||||
|
||||
// No setup happened:
|
||||
void grass_shutdown(magic_api * api)
|
||||
void grass_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (grass_snd != NULL)
|
||||
Mix_FreeChunk(grass_snd);
|
||||
}
|
||||
|
||||
// Record the color from Tux Paint:
|
||||
void grass_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void grass_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r, Uint8 g, Uint8 b)
|
||||
{
|
||||
grass_r = r;
|
||||
grass_g = g;
|
||||
|
|
@ -148,13 +168,13 @@ void grass_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
|||
}
|
||||
|
||||
// Use colors:
|
||||
int grass_requires_colors(magic_api * api, int which)
|
||||
int grass_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static void do_grass(void * ptr, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
static void do_grass(void * ptr, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x, int y)
|
||||
{
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
|
|
@ -244,15 +264,15 @@ static int log2int(int x)
|
|||
return y;
|
||||
}
|
||||
|
||||
void grass_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void grass_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void grass_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void grass_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int grass_modes(magic_api * api, int which)
|
||||
int grass_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue