Less warnings in magic tools by GCI students finaiized and m4tx.
This commit is contained in:
parent
b75f6d513b
commit
1abe844c46
5 changed files with 213 additions and 84 deletions
|
|
@ -35,6 +35,32 @@
|
|||
|
||||
static Mix_Chunk * negative_snd;
|
||||
|
||||
int negative_init(magic_api * api);
|
||||
Uint32 negative_api_version(void);
|
||||
int negative_get_tool_count(magic_api * api);
|
||||
SDL_Surface * negative_get_icon(magic_api * api, int which);
|
||||
char * negative_get_name(magic_api * api, int which);
|
||||
char * negative_get_description(magic_api * api, int which, int mode);
|
||||
static void do_negative(void * ptr, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y);
|
||||
void negative_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 negative_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void negative_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void negative_shutdown(magic_api * api);
|
||||
void negative_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int negative_requires_colors(magic_api * api, int which);
|
||||
void negative_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void negative_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int negative_modes(magic_api * api, int which);
|
||||
|
||||
// No setup required:
|
||||
int negative_init(magic_api * api)
|
||||
{
|
||||
|
|
@ -51,13 +77,13 @@ int negative_init(magic_api * api)
|
|||
Uint32 negative_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||
|
||||
// Only one tool:
|
||||
int negative_get_tool_count(magic_api * api)
|
||||
int negative_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(1);
|
||||
}
|
||||
|
||||
// Load our icon:
|
||||
SDL_Surface * negative_get_icon(magic_api * api, int which)
|
||||
SDL_Surface * negative_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char fname[1024];
|
||||
|
||||
|
|
@ -67,13 +93,13 @@ SDL_Surface * negative_get_icon(magic_api * api, int which)
|
|||
}
|
||||
|
||||
// Return our name, localized:
|
||||
char * negative_get_name(magic_api * api, int which)
|
||||
char * negative_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Negative")));
|
||||
}
|
||||
|
||||
// Return our description, localized:
|
||||
char * negative_get_description(magic_api * api, int which, int mode)
|
||||
char * negative_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode)
|
||||
{
|
||||
if (mode == MODE_PAINT)
|
||||
return(strdup(
|
||||
|
|
@ -86,7 +112,7 @@ char * negative_get_description(magic_api * api, int which, int mode)
|
|||
}
|
||||
|
||||
// Callback that does the negative color effect on a circle centered around x,y
|
||||
static void do_negative(void * ptr, int which,
|
||||
static void do_negative(void * ptr, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y)
|
||||
{
|
||||
|
|
@ -171,39 +197,39 @@ void negative_click(magic_api * api, int which, int mode,
|
|||
}
|
||||
|
||||
|
||||
void negative_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void negative_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)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
void negative_shutdown(magic_api * api)
|
||||
void negative_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (negative_snd != NULL)
|
||||
Mix_FreeChunk(negative_snd);
|
||||
}
|
||||
|
||||
// We don't use colors
|
||||
void negative_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void negative_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// We don't use colors
|
||||
int negative_requires_colors(magic_api * api, int which)
|
||||
int negative_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void negative_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void negative_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void negative_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void negative_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int negative_modes(magic_api * api, int which)
|
||||
int negative_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT | MODE_FULLSCREEN);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -67,6 +67,33 @@ const char * noise_descs[noise_NUM_TOOLS][2] = {
|
|||
gettext_noop("Click to add noise to your entire picture."),},
|
||||
};
|
||||
|
||||
Uint32 noise_api_version(void);
|
||||
int noise_init(magic_api * api);
|
||||
SDL_Surface * noise_get_icon(magic_api * api, int which);
|
||||
char * noise_get_name(magic_api * api, int which);
|
||||
char * noise_get_description(magic_api * api, int which, int mode);
|
||||
static void do_noise_pixel(void * ptr, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y);
|
||||
static void do_noise_full(void * ptr,SDL_Surface * canvas, SDL_Surface * last, int which);
|
||||
static void do_noise_brush(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last, int x, int y);
|
||||
void noise_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 noise_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void noise_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void noise_shutdown(magic_api * api);
|
||||
void noise_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int noise_requires_colors(magic_api * api, int which);
|
||||
void noise_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void noise_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int noise_modes(magic_api * api, int which);
|
||||
int noise_get_tool_count(magic_api * api ATTRIBUTE_UNUSED);
|
||||
|
||||
Uint32 noise_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||
|
||||
//Load sounds
|
||||
|
|
@ -83,7 +110,7 @@ int noise_init(magic_api * api){
|
|||
return(1);
|
||||
}
|
||||
|
||||
int noise_get_tool_count(magic_api * api){
|
||||
int noise_get_tool_count(magic_api * api ATTRIBUTE_UNUSED){
|
||||
return(noise_NUM_TOOLS);
|
||||
}
|
||||
|
||||
|
|
@ -95,18 +122,18 @@ SDL_Surface * noise_get_icon(magic_api * api, int which){
|
|||
}
|
||||
|
||||
// Return our names, localized:
|
||||
char * noise_get_name(magic_api * api, int which){
|
||||
char * noise_get_name(magic_api * api ATTRIBUTE_UNUSED, int which){
|
||||
return(strdup(gettext_noop(noise_names[which])));
|
||||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char * noise_get_description(magic_api * api, int which, int mode){
|
||||
char * noise_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode){
|
||||
return(strdup(gettext_noop(noise_descs[which][mode-1])));
|
||||
}
|
||||
|
||||
//Do the effect for one pixel
|
||||
static void do_noise_pixel(void * ptr, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
static void do_noise_pixel(void * ptr, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x, int y){
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
|
||||
|
|
@ -124,9 +151,6 @@ static void do_noise_pixel(void * ptr, int which,
|
|||
|
||||
// Do the effect for the full image
|
||||
static void do_noise_full(void * ptr,SDL_Surface * canvas, SDL_Surface * last, int which){
|
||||
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
|
||||
int x,y;
|
||||
|
||||
for (y = 0; y < last->h; y++){
|
||||
|
|
@ -189,14 +213,14 @@ void noise_click(magic_api * api, int which, int mode,
|
|||
}
|
||||
|
||||
// Affect the canvas on release:
|
||||
void noise_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void noise_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 noise_shutdown(magic_api * api)
|
||||
void noise_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
//Clean up sounds
|
||||
int i;
|
||||
|
|
@ -208,25 +232,25 @@ void noise_shutdown(magic_api * api)
|
|||
}
|
||||
|
||||
// Record the color from Tux Paint:
|
||||
void noise_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void noise_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// Use colors:
|
||||
int noise_requires_colors(magic_api * api, int which)
|
||||
int noise_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void noise_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void noise_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void noise_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void noise_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int noise_modes(magic_api * api, int which)
|
||||
int noise_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_FULLSCREEN|MODE_PAINT);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -42,10 +42,36 @@
|
|||
|
||||
static Mix_Chunk * puzzle_snd;
|
||||
static int puzzle_gcd=0; //length of side of each rectangle; 0 is temporary value.
|
||||
static int puzzle_rect_q=4; //quantity of rectangles when using paint mode. Must be an odd value - but it's even!
|
||||
// static int puzzle_rect_q=4; //quantity of rectangles when using paint mode. Must be an odd value - but it's even!
|
||||
static int rects_w, rects_h;
|
||||
SDL_Surface * canvas_backup;
|
||||
|
||||
Uint32 puzzle_api_version(void) ;
|
||||
int puzzle_init(magic_api * api);
|
||||
int puzzle_get_tool_count(magic_api * api);
|
||||
SDL_Surface * puzzle_get_icon(magic_api * api, int which);
|
||||
char * puzzle_get_name(magic_api * api, int which);
|
||||
char * puzzle_get_description(magic_api * api, int which, int mode);
|
||||
void puzzle_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void puzzle_shutdown(magic_api * api);
|
||||
void puzzle_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int puzzle_requires_colors(magic_api * api, int which);
|
||||
void puzzle_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void puzzle_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int puzzle_modes(magic_api * api, int which);
|
||||
static void puzzle_draw(void * ptr, int which_tool,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y);
|
||||
void puzzle_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 puzzle_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
int gcd(int a, int b);
|
||||
|
||||
Uint32 puzzle_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||
|
||||
int puzzle_init(magic_api * api)
|
||||
|
|
@ -59,12 +85,12 @@ int puzzle_init(magic_api * api)
|
|||
return 1 ;
|
||||
}
|
||||
|
||||
int puzzle_get_tool_count(magic_api * api)
|
||||
int puzzle_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_Surface * puzzle_get_icon(magic_api * api, int which)
|
||||
SDL_Surface * puzzle_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char fname[1024];
|
||||
|
||||
|
|
@ -74,37 +100,37 @@ SDL_Surface * puzzle_get_icon(magic_api * api, int which)
|
|||
return(IMG_Load(fname));
|
||||
}
|
||||
|
||||
char * puzzle_get_name(magic_api * api, int which)
|
||||
char * puzzle_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(strdup(gettext_noop("Puzzle")));
|
||||
}
|
||||
|
||||
|
||||
char * puzzle_get_description(magic_api * api, int which, int mode)
|
||||
char * puzzle_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode)
|
||||
{
|
||||
if (mode==MODE_PAINT)
|
||||
return strdup(gettext_noop("Click the part of your picture where would you like a puzzle."));
|
||||
return strdup(gettext_noop("Click to make a puzzle in fullscreen mode."));
|
||||
}
|
||||
|
||||
void puzzle_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void puzzle_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)
|
||||
{
|
||||
api->playsound(puzzle_snd, 128, 255);
|
||||
}
|
||||
|
||||
void puzzle_shutdown(magic_api * api)
|
||||
void puzzle_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (puzzle_snd != NULL)
|
||||
Mix_FreeChunk(puzzle_snd);
|
||||
}
|
||||
|
||||
void puzzle_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void puzzle_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int puzzle_requires_colors(magic_api * api, int which)
|
||||
int puzzle_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -115,7 +141,7 @@ int gcd(int a, int b) //greatest common divisor
|
|||
return gcd(b, a%b);
|
||||
}
|
||||
|
||||
void puzzle_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void puzzle_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas)
|
||||
{
|
||||
puzzle_gcd=RATIO*gcd(canvas->w, canvas->h);
|
||||
rects_w=(unsigned int)canvas->w/puzzle_gcd;
|
||||
|
|
@ -123,25 +149,25 @@ void puzzle_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
|||
canvas_backup = SDL_CreateRGBSurface(SDL_ANYFORMAT,canvas->w, canvas->h, canvas->format->BitsPerPixel, canvas->format->Rmask, canvas->format->Gmask, canvas->format->Bmask, canvas->format->Amask);
|
||||
}
|
||||
|
||||
void puzzle_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void puzzle_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
SDL_FreeSurface(canvas_backup);
|
||||
canvas_backup = NULL;
|
||||
}
|
||||
|
||||
int puzzle_modes(magic_api * api, int which)
|
||||
int puzzle_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT);
|
||||
}
|
||||
|
||||
static void puzzle_draw(void * ptr, int which_tool,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y)
|
||||
static void puzzle_draw(void * ptr, int which_tool ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED, int x, int y)
|
||||
{
|
||||
|
||||
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
|
||||
Uint8 i, j, r; //r - random value
|
||||
Uint8 r; //r - random value
|
||||
SDL_Rect rect_this, rect_that;
|
||||
|
||||
SDL_BlitSurface(canvas, NULL, canvas_backup, NULL);
|
||||
|
|
@ -193,7 +219,7 @@ static void puzzle_draw(void * ptr, int which_tool,
|
|||
}
|
||||
|
||||
void puzzle_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 ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED, int x, int y,
|
||||
SDL_Rect * update_rect)
|
||||
{
|
||||
puzzle_draw(api, which, canvas, last, x-puzzle_gcd/2, y-puzzle_gcd/2);
|
||||
|
|
@ -209,7 +235,7 @@ void puzzle_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
update_rect->w=canvas->w;
|
||||
}
|
||||
|
||||
void puzzle_click(magic_api * api, int which, int mode,
|
||||
void puzzle_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -34,23 +34,53 @@ static SDL_Rect modification_rect;
|
|||
static SDL_Surface * canvas_backup;
|
||||
// Housekeeping functions
|
||||
|
||||
SDL_Surface * rails_one, * rails_three, * rails_four, * rails_corner;
|
||||
|
||||
Uint32 rails_api_version(void);
|
||||
int rails_modes(magic_api * api, int which);
|
||||
void rails_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int rails_init(magic_api * api);
|
||||
int rails_get_tool_count(magic_api * api);
|
||||
SDL_Surface * rails_get_icon(magic_api * api, int which);
|
||||
char * rails_get_name(magic_api * api, int which);
|
||||
char * rails_get_description(magic_api * api, int which, int mode);
|
||||
int rails_requires_colors(magic_api * api, int which);
|
||||
void rails_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void rails_shutdown(magic_api * api);
|
||||
void rails_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void rails_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
static int rails_math_ceil(int x, int y);
|
||||
inline unsigned int rails_get_segment(int x, int y);
|
||||
inline void rails_extract_coords_from_segment(unsigned int segment, Sint16 * x, Sint16 * y);
|
||||
static void rails_flip(void * ptr, SDL_Surface * dest, SDL_Surface * src);
|
||||
static void rails_flip_flop(void * ptr, SDL_Surface * dest, SDL_Surface * src);
|
||||
static void rails_rotate (void * ptr, SDL_Surface * dest, SDL_Surface * src, unsigned int direction);
|
||||
void rails_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
static Uint8 rails_select_image(Uint16 segment);
|
||||
static void rails_draw(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, unsigned int segment);
|
||||
|
||||
static void rails_draw_wrapper(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y);
|
||||
void rails_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 * rails_one, * rails_three, * rails_four, * rails_corner;
|
||||
|
||||
Uint32 rails_api_version(void)
|
||||
{
|
||||
return(TP_MAGIC_API_VERSION);
|
||||
}
|
||||
|
||||
int rails_modes(magic_api * api, int which)
|
||||
int rails_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT);
|
||||
}
|
||||
|
||||
void rails_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void rails_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
|
|
@ -83,12 +113,12 @@ int rails_init(magic_api * api)
|
|||
return(1);
|
||||
}
|
||||
|
||||
int rails_get_tool_count(magic_api * api)
|
||||
int rails_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
SDL_Surface * rails_get_icon(magic_api * api, int which)
|
||||
SDL_Surface * rails_get_icon(magic_api * api, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
char fname[1024];
|
||||
|
||||
|
|
@ -98,19 +128,19 @@ SDL_Surface * rails_get_icon(magic_api * api, int which)
|
|||
return(IMG_Load(fname));
|
||||
}
|
||||
|
||||
char * rails_get_name(magic_api * api, int which) { return strdup(gettext_noop("Rails")); }
|
||||
char * rails_get_name(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) { return strdup(gettext_noop("Rails")); }
|
||||
|
||||
char * rails_get_description(magic_api * api, int which, int mode) { return strdup(gettext_noop("Click and drag to draw train track rails on your picture.")); }
|
||||
char * rails_get_description(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) { return strdup(gettext_noop("Click and drag to draw train track rails on your picture.")); }
|
||||
|
||||
int rails_requires_colors(magic_api * api, int which) { return 0;}
|
||||
int rails_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED) { return 0;}
|
||||
|
||||
void rails_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void rails_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * snapshot ATTRIBUTE_UNUSED,
|
||||
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void rails_shutdown(magic_api * api)
|
||||
void rails_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
Uint8 i;
|
||||
|
||||
|
|
@ -129,7 +159,7 @@ void rails_shutdown(magic_api * api)
|
|||
free(rails_status_of_segments);
|
||||
}
|
||||
|
||||
void rails_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void rails_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas)
|
||||
{
|
||||
//we've to compute the quantity of segments in each direction
|
||||
|
||||
|
|
@ -143,7 +173,7 @@ void rails_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
|||
rails_status_of_segments=(Uint8 *)calloc(rails_segments_x*rails_segments_y + 1, sizeof(Uint8));
|
||||
}
|
||||
|
||||
void rails_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void rails_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (rails_status_of_segments != NULL)
|
||||
{
|
||||
|
|
@ -222,7 +252,7 @@ static void rails_rotate (void * ptr, SDL_Surface * dest, SDL_Surface * src, uns
|
|||
|
||||
}
|
||||
|
||||
void rails_click(magic_api * api, int which, int mode,
|
||||
void rails_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * snapshot,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
|
|
@ -232,7 +262,7 @@ void rails_click(magic_api * api, int which, int mode,
|
|||
|
||||
static Uint8 rails_select_image(Uint16 segment)
|
||||
{
|
||||
int take_up, take_down, take_left, take_right;
|
||||
int take_up, take_down;
|
||||
int val_up, val_down, val_left, val_right;
|
||||
int from_top=0, from_bottom=0, from_left = 0, from_right = 0;
|
||||
int from_top_right=0, from_top_left=0, from_bottom_right=0, from_bottom_left = 0;
|
||||
|
|
@ -338,8 +368,8 @@ static Uint8 rails_select_image(Uint16 segment)
|
|||
|
||||
}
|
||||
|
||||
static void rails_draw(void * ptr, int which, SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, unsigned int segment)
|
||||
static void rails_draw(void * ptr, int which ATTRIBUTE_UNUSED, ATTRIBUTE_UNUSED SDL_Surface * canvas, SDL_Surface * last ATTRIBUTE_UNUSED,
|
||||
int x, int y ATTRIBUTE_UNUSED, unsigned int segment)
|
||||
{
|
||||
magic_api * api = (magic_api *) ptr;
|
||||
SDL_Surface * result, * temp;
|
||||
|
|
|
|||
|
|
@ -36,6 +36,29 @@
|
|||
|
||||
static Mix_Chunk * waves_snd[2];
|
||||
|
||||
/* Local function prototypes: */
|
||||
|
||||
Uint32 waves_api_version(void);
|
||||
int waves_init(magic_api * api);
|
||||
int waves_get_tool_count(magic_api * api);
|
||||
SDL_Surface * waves_get_icon(magic_api * api, int which);
|
||||
char * waves_get_name(magic_api * api, int which);
|
||||
char * waves_get_description(magic_api * api, int which, int mode);
|
||||
void waves_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 waves_click(magic_api * api, int which, int mode,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void waves_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect);
|
||||
void waves_shutdown(magic_api * api);
|
||||
void waves_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b);
|
||||
int waves_requires_colors(magic_api * api, int which);
|
||||
void waves_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
void waves_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas);
|
||||
int waves_modes(magic_api * api, int which);
|
||||
|
||||
Uint32 waves_api_version(void) { return(TP_MAGIC_API_VERSION); }
|
||||
|
||||
|
|
@ -58,7 +81,7 @@ int waves_init(magic_api * api)
|
|||
}
|
||||
|
||||
// We have multiple tools:
|
||||
int waves_get_tool_count(magic_api * api)
|
||||
int waves_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 2;
|
||||
}
|
||||
|
|
@ -75,14 +98,14 @@ SDL_Surface * waves_get_icon(magic_api * api, int which)
|
|||
}
|
||||
|
||||
// Return our names, localized:
|
||||
char * waves_get_name(magic_api * api, int which)
|
||||
char * waves_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
|
||||
{
|
||||
if (!which) return(strdup(gettext_noop("Waves")));
|
||||
else return strdup(gettext_noop("Wavelets"));
|
||||
}
|
||||
|
||||
// Return our descriptions, localized:
|
||||
char * waves_get_description(magic_api * api, int which, int mode)
|
||||
char * waves_get_description(magic_api * api ATTRIBUTE_UNUSED, int which, int mode ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (!which)
|
||||
return(strdup(gettext_noop("Click to make the picture horizontally wavy. Click toward the top for shorter waves, the bottom for taller waves, the left for small waves, and the right for long waves.")));
|
||||
|
|
@ -90,8 +113,8 @@ char * waves_get_description(magic_api * api, int which, int mode)
|
|||
}
|
||||
|
||||
|
||||
void waves_drag(magic_api * api, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox, int oy, int x, int y,
|
||||
void waves_drag(magic_api * api ATTRIBUTE_UNUSED, int which, SDL_Surface * canvas,
|
||||
SDL_Surface * last, int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED, int x, int y,
|
||||
SDL_Rect * update_rect)
|
||||
{
|
||||
int xx, yy;
|
||||
|
|
@ -149,7 +172,7 @@ void waves_drag(magic_api * api, int which, SDL_Surface * canvas,
|
|||
}
|
||||
|
||||
// Affect the canvas on click:
|
||||
void waves_click(magic_api * api, int which, int mode,
|
||||
void waves_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
{
|
||||
|
|
@ -158,14 +181,14 @@ void waves_click(magic_api * api, int which, int mode,
|
|||
}
|
||||
|
||||
// Affect the canvas on release:
|
||||
void waves_release(magic_api * api, int which,
|
||||
SDL_Surface * canvas, SDL_Surface * last,
|
||||
int x, int y, SDL_Rect * update_rect)
|
||||
void waves_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 waves_shutdown(magic_api * api)
|
||||
void waves_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (waves_snd[0] != NULL)
|
||||
Mix_FreeChunk(waves_snd[0]);
|
||||
|
|
@ -174,25 +197,25 @@ void waves_shutdown(magic_api * api)
|
|||
}
|
||||
|
||||
// Record the color from Tux Paint:
|
||||
void waves_set_color(magic_api * api, Uint8 r, Uint8 g, Uint8 b)
|
||||
void waves_set_color(magic_api * api ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
// Use colors:
|
||||
int waves_requires_colors(magic_api * api, int which)
|
||||
int waves_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
void waves_switchin(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void waves_switchin(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
void waves_switchout(magic_api * api, int which, int mode, SDL_Surface * canvas)
|
||||
void waves_switchout(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED)
|
||||
{
|
||||
}
|
||||
|
||||
int waves_modes(magic_api * api, int which)
|
||||
int waves_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
|
||||
{
|
||||
return(MODE_PAINT);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue