Bill Kendrick 2023-03-19 21:51:59 -07:00
parent 55b815affc
commit 273b66f15f
3 changed files with 92 additions and 87 deletions

View file

@ -194,6 +194,11 @@ https://tuxpaint.org/
Closes https://sourceforge.net/p/tuxpaint/bugs/259/ Closes https://sourceforge.net/p/tuxpaint/bugs/259/
Bill Kendrick <bill@newbreedsoftware.com> Bill Kendrick <bill@newbreedsoftware.com>
* Magic tools with very long filenames/function names did not load
on some Android systems. Affected new Kaleido-* tools, but also
Blocks, Chalk, and Drip (hence this being listed as a bug fix).
h/t Pere for discovering this.
* SDL1.2 supported "SDL_VIDEO_WINDOW_POS" environment variable, * SDL1.2 supported "SDL_VIDEO_WINDOW_POS" environment variable,
but SDL2 does not; so reimplemented it ourselves. (See ENVARS docs.) but SDL2 does not; so reimplemented it ourselves. (See ENVARS docs.)
Bill Kendrick <bill@newbreedsoftware.com> Bill Kendrick <bill@newbreedsoftware.com>

View file

@ -1,5 +1,5 @@
/* /*
blocks_chalk_drip.c blocks_etc.c
Blocks, Chalk and Drip Magic Tools Plugin Blocks, Chalk and Drip Magic Tools Plugin
Tux Paint - A simple drawing program for children. Tux Paint - A simple drawing program for children.
@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt) (See COPYING.txt)
Last updated: February 12, 2023 Last updated: March 19, 2023
*/ */
#include <stdio.h> #include <stdio.h>
@ -52,38 +52,38 @@ static Mix_Chunk *snd_effect[NUM_TOOLS];
/* Our function prototypes: */ /* Our function prototypes: */
int blocks_chalk_drip_init(magic_api * api); int blocks_etc_init(magic_api * api);
Uint32 blocks_chalk_drip_api_version(void); Uint32 blocks_etc_api_version(void);
int blocks_chalk_drip_get_tool_count(magic_api * api); int blocks_etc_get_tool_count(magic_api * api);
SDL_Surface *blocks_chalk_drip_get_icon(magic_api * api, int which); SDL_Surface *blocks_etc_get_icon(magic_api * api, int which);
char *blocks_chalk_drip_get_name(magic_api * api, int which); char *blocks_etc_get_name(magic_api * api, int which);
int blocks_chalk_drip_get_group(magic_api * api, int which); int blocks_etc_get_group(magic_api * api, int which);
char *blocks_chalk_drip_get_description(magic_api * api, int which, int mode); char *blocks_etc_get_description(magic_api * api, int which, int mode);
static void blocks_chalk_drip_linecb(void *ptr, int which, static void blocks_etc_linecb(void *ptr, int which,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y); int x, int y);
void blocks_chalk_drip_drag(magic_api * api, int which, SDL_Surface * canvas, void blocks_etc_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, int oy, int x, int y,
SDL_Rect * update_rect); SDL_Rect * update_rect);
void blocks_chalk_drip_click(magic_api * api, int which, int mode, void blocks_etc_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, int x, SDL_Surface * canvas, SDL_Surface * last, int x,
int y, SDL_Rect * update_rect); int y, SDL_Rect * update_rect);
void blocks_chalk_drip_release(magic_api * api, int which, void blocks_etc_release(magic_api * api, int which,
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 blocks_chalk_drip_shutdown(magic_api * api); void blocks_etc_shutdown(magic_api * api);
void blocks_chalk_drip_set_color(magic_api * api, int which, SDL_Surface * canvas, void blocks_etc_set_color(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect); SDL_Surface * last, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect);
int blocks_chalk_drip_requires_colors(magic_api * api, int which); int blocks_etc_requires_colors(magic_api * api, int which);
void blocks_chalk_drip_switchin(magic_api * api, int which, int mode, void blocks_etc_switchin(magic_api * api, int which, int mode,
SDL_Surface * canvas); SDL_Surface * canvas);
void blocks_chalk_drip_switchout(magic_api * api, int which, int mode, void blocks_etc_switchout(magic_api * api, int which, int mode,
SDL_Surface * canvas); SDL_Surface * canvas);
int blocks_chalk_drip_modes(magic_api * api, int which); int blocks_etc_modes(magic_api * api, int which);
int blocks_chalk_drip_init(magic_api * api) int blocks_etc_init(magic_api * api)
{ {
char fname[1024]; char fname[1024];
@ -102,20 +102,20 @@ int blocks_chalk_drip_init(magic_api * api)
return (1); return (1);
} }
Uint32 blocks_chalk_drip_api_version(void) Uint32 blocks_etc_api_version(void)
{ {
return (TP_MAGIC_API_VERSION); return (TP_MAGIC_API_VERSION);
} }
// We have multiple tools: // We have multiple tools:
int blocks_chalk_drip_get_tool_count(magic_api * api ATTRIBUTE_UNUSED) int blocks_etc_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
{ {
return (NUM_TOOLS); return (NUM_TOOLS);
} }
// Load our icons: // Load our icons:
SDL_Surface *blocks_chalk_drip_get_icon(magic_api * api, int which) SDL_Surface *blocks_etc_get_icon(magic_api * api, int which)
{ {
char fname[1024]; char fname[1024];
@ -139,7 +139,7 @@ SDL_Surface *blocks_chalk_drip_get_icon(magic_api * api, int which)
} }
// Return our names, localized: // Return our names, localized:
char *blocks_chalk_drip_get_name(magic_api * api ATTRIBUTE_UNUSED, int which) char *blocks_etc_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
{ {
if (which == TOOL_BLOCKS) if (which == TOOL_BLOCKS)
return (strdup(gettext_noop("Blocks"))); return (strdup(gettext_noop("Blocks")));
@ -152,14 +152,14 @@ char *blocks_chalk_drip_get_name(magic_api * api ATTRIBUTE_UNUSED, int which)
} }
// Return our group (all the same): // Return our group (all the same):
int blocks_chalk_drip_get_group(magic_api * api ATTRIBUTE_UNUSED, int blocks_etc_get_group(magic_api * api ATTRIBUTE_UNUSED,
int which ATTRIBUTE_UNUSED) int which ATTRIBUTE_UNUSED)
{ {
return MAGIC_TYPE_DISTORTS; return MAGIC_TYPE_DISTORTS;
} }
// Return our descriptions, localized: // Return our descriptions, localized:
char *blocks_chalk_drip_get_description(magic_api * api ATTRIBUTE_UNUSED, char *blocks_etc_get_description(magic_api * api ATTRIBUTE_UNUSED,
int which, int mode) int which, int mode)
{ {
if (which == TOOL_BLOCKS) if (which == TOOL_BLOCKS)
@ -210,7 +210,7 @@ char *blocks_chalk_drip_get_description(magic_api * api ATTRIBUTE_UNUSED,
// Do the effect: // Do the effect:
static void blocks_chalk_drip_linecb(void *ptr, int which, static void blocks_etc_linecb(void *ptr, int which,
SDL_Surface * canvas, SDL_Surface * last, SDL_Surface * canvas, SDL_Surface * last,
int x, int y) int x, int y)
{ {
@ -331,12 +331,12 @@ static void blocks_chalk_drip_linecb(void *ptr, int which,
} }
// Affect the canvas on drag: // Affect the canvas on drag:
void blocks_chalk_drip_drag(magic_api * api, int which, SDL_Surface * canvas, void blocks_etc_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, int oy, int x, int y,
SDL_Rect * update_rect) SDL_Rect * update_rect)
{ {
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1, api->line((void *) api, which, canvas, last, ox, oy, x, y, 1,
blocks_chalk_drip_linecb); blocks_etc_linecb);
if (ox > x) if (ox > x)
{ {
@ -362,13 +362,13 @@ void blocks_chalk_drip_drag(magic_api * api, int which, SDL_Surface * canvas,
} }
// Affect the canvas on click: // Affect the canvas on click:
void blocks_chalk_drip_click(magic_api * api, int which, int mode, void blocks_etc_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * last, int x, SDL_Surface * canvas, SDL_Surface * last, int x,
int y, SDL_Rect * update_rect) int y, SDL_Rect * update_rect)
{ {
if (mode == MODE_PAINT) if (mode == MODE_PAINT)
{ {
blocks_chalk_drip_drag(api, which, canvas, last, x, y, x, y, update_rect); blocks_etc_drag(api, which, canvas, last, x, y, x, y, update_rect);
} }
else /* MODE_FULLSCREEN */ else /* MODE_FULLSCREEN */
{ {
@ -382,7 +382,7 @@ void blocks_chalk_drip_click(magic_api * api, int which, int mode,
} }
for (x = 0; x < canvas->w; x += EFFECT_REZ) for (x = 0; x < canvas->w; x += EFFECT_REZ)
{ {
blocks_chalk_drip_linecb(api, which, canvas, last, x, y); blocks_etc_linecb(api, which, canvas, last, x, y);
} }
} }
} }
@ -398,7 +398,7 @@ void blocks_chalk_drip_click(magic_api * api, int which, int mode,
} }
for (x = 0; x < canvas->w; x += EFFECT_REZ) for (x = 0; x < canvas->w; x += EFFECT_REZ)
{ {
blocks_chalk_drip_linecb(api, which, canvas, last, x, y); blocks_etc_linecb(api, which, canvas, last, x, y);
} }
} }
} }
@ -412,7 +412,7 @@ void blocks_chalk_drip_click(magic_api * api, int which, int mode,
} }
// Affect the canvas on release: // Affect the canvas on release:
void blocks_chalk_drip_release(magic_api * api ATTRIBUTE_UNUSED, void blocks_etc_release(magic_api * api ATTRIBUTE_UNUSED,
int which ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED,
SDL_Surface * last ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
@ -422,7 +422,7 @@ void blocks_chalk_drip_release(magic_api * api ATTRIBUTE_UNUSED,
} }
// No setup happened: // No setup happened:
void blocks_chalk_drip_shutdown(magic_api * api ATTRIBUTE_UNUSED) void blocks_etc_shutdown(magic_api * api ATTRIBUTE_UNUSED)
{ {
if (snd_effect[0] != NULL) if (snd_effect[0] != NULL)
Mix_FreeChunk(snd_effect[0]); Mix_FreeChunk(snd_effect[0]);
@ -432,33 +432,33 @@ void blocks_chalk_drip_shutdown(magic_api * api ATTRIBUTE_UNUSED)
} }
// Record the color from Tux Paint: // Record the color from Tux Paint:
void blocks_chalk_drip_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED, void blocks_etc_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED,
SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED) SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
{ {
} }
// Use colors: // Use colors:
int blocks_chalk_drip_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int blocks_etc_requires_colors(magic_api * api ATTRIBUTE_UNUSED,
int which ATTRIBUTE_UNUSED) int which ATTRIBUTE_UNUSED)
{ {
return 0; return 0;
} }
void blocks_chalk_drip_switchin(magic_api * api ATTRIBUTE_UNUSED, void blocks_etc_switchin(magic_api * api ATTRIBUTE_UNUSED,
int which ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
int mode ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED) SDL_Surface * canvas ATTRIBUTE_UNUSED)
{ {
} }
void blocks_chalk_drip_switchout(magic_api * api ATTRIBUTE_UNUSED, void blocks_etc_switchout(magic_api * api ATTRIBUTE_UNUSED,
int which ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
int mode ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED) SDL_Surface * canvas ATTRIBUTE_UNUSED)
{ {
} }
int blocks_chalk_drip_modes(magic_api * api ATTRIBUTE_UNUSED, int which) int blocks_etc_modes(magic_api * api ATTRIBUTE_UNUSED, int which)
{ {
if (which == TOOL_BLOCKS || TOOL_CHALK) if (which == TOOL_BLOCKS || TOOL_CHALK)
{ {

View file

@ -1,10 +1,10 @@
/* kaleidoscope_lens.c /* kaleidox.c
Transform the canvas as though looking at it through a Transform the canvas as though looking at it through a
kaleidoscope. kaleidoscope.
Bill Kendrick Bill Kendrick
Last updated: March 8, 2023 Last updated: March 19, 2023
*/ */
#include <stdio.h> #include <stdio.h>
@ -23,25 +23,25 @@ enum {
NUM_TOOLS NUM_TOOLS
}; };
static char * kaleidoscope_lens_snd_filenames[NUM_TOOLS] = { static char * kaleidox_snd_fnames[NUM_TOOLS] = {
"kaleido-4.ogg", "kaleido-4.ogg",
"kaleido-6.ogg", "kaleido-6.ogg",
"kaleido-8.ogg", "kaleido-8.ogg",
}; };
static char * kaleidoscope_lens_icon_filenames[NUM_TOOLS] = { static char * kaleidox_icon_fnames[NUM_TOOLS] = {
"kaleido-4.png", "kaleido-4.png",
"kaleido-6.png", "kaleido-6.png",
"kaleido-8.png", "kaleido-8.png",
}; };
char * kaleidoscope_lens_names[NUM_TOOLS] = { char * kaleidox_names[NUM_TOOLS] = {
gettext_noop("Kaleido-4"), gettext_noop("Kaleido-4"),
gettext_noop("Kaleido-6"), gettext_noop("Kaleido-6"),
gettext_noop("Kaleido-8"), gettext_noop("Kaleido-8"),
}; };
char * kaleidoscope_lens_descrs[NUM_TOOLS] = { char * kaleidox_descrs[NUM_TOOLS] = {
gettext_noop("Click and drag around your picture to look through it with a kaleidoscope!"), gettext_noop("Click and drag around your picture to look through it with a kaleidoscope!"),
gettext_noop("Click and drag around your picture to look through it with a kaleidoscope!"), gettext_noop("Click and drag around your picture to look through it with a kaleidoscope!"),
gettext_noop("Click and drag around your picture to look through it with a kaleidoscope!"), gettext_noop("Click and drag around your picture to look through it with a kaleidoscope!"),
@ -49,102 +49,102 @@ char * kaleidoscope_lens_descrs[NUM_TOOLS] = {
Mix_Chunk *snd_effects[NUM_TOOLS]; Mix_Chunk *snd_effects[NUM_TOOLS];
Uint32 kaleidoscope_lens_api_version(void); Uint32 kaleidox_api_version(void);
int kaleidoscope_lens_init(magic_api * api); int kaleidox_init(magic_api * api);
int kaleidoscope_lens_get_tool_count(magic_api * api); int kaleidox_get_tool_count(magic_api * api);
SDL_Surface *kaleidoscope_lens_get_icon(magic_api * api, int which); SDL_Surface *kaleidox_get_icon(magic_api * api, int which);
char *kaleidoscope_lens_get_name(magic_api * api, int which); char *kaleidox_get_name(magic_api * api, int which);
int kaleidoscope_lens_get_group(magic_api * api, int which); int kaleidox_get_group(magic_api * api, int which);
char *kaleidoscope_lens_get_description(magic_api * api, int which, int mode); char *kaleidox_get_description(magic_api * api, int which, int mode);
int kaleidoscope_lens_requires_colors(magic_api * api, int which); int kaleidox_requires_colors(magic_api * api, int which);
int kaleidoscope_lens_modes(magic_api * api, int which); int kaleidox_modes(magic_api * api, int which);
void kaleidoscope_lens_shutdown(magic_api * api); void kaleidox_shutdown(magic_api * api);
void kaleidoscope_lens_click(magic_api * api, int which, int mode, void kaleidox_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot, int x, SDL_Surface * canvas, SDL_Surface * snapshot, int x,
int y, SDL_Rect * update_rect); int y, SDL_Rect * update_rect);
void kaleidoscope_lens_set_color(magic_api * api, int which, SDL_Surface * canvas, void kaleidox_set_color(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect); SDL_Surface * last, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect);
void kaleidoscope_lens_drag(magic_api * api, int which, SDL_Surface * canvas, void kaleidox_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 kaleidoscope_lens_render(magic_api *, int which, SDL_Surface * canvas, void kaleidox_render(magic_api *, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, int x, int y, int preview); SDL_Surface * snapshot, int x, int y, int preview);
void kaleidoscope_lens_release(magic_api * api, int which, SDL_Surface * canvas, void kaleidox_release(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, int x, int y, SDL_Surface * snapshot, int x, int y,
SDL_Rect * update_rect); SDL_Rect * update_rect);
void kaleidoscope_lens_switchin(magic_api * api, int which, int mode, void kaleidox_switchin(magic_api * api, int which, int mode,
SDL_Surface * canvas); SDL_Surface * canvas);
void kaleidoscope_lens_switchout(magic_api * api, int which, int mode, void kaleidox_switchout(magic_api * api, int which, int mode,
SDL_Surface * canvas); SDL_Surface * canvas);
int mirror(int n, int max, int flip); int mirror(int n, int max, int flip);
Uint32 kaleidoscope_lens_api_version(void) Uint32 kaleidox_api_version(void)
{ {
return (TP_MAGIC_API_VERSION); return (TP_MAGIC_API_VERSION);
} }
int kaleidoscope_lens_init(magic_api * api) int kaleidox_init(magic_api * api)
{ {
int i; int i;
char fname[1024]; char fname[1024];
for (i = 0; i < NUM_TOOLS; i++) { for (i = 0; i < NUM_TOOLS; i++) {
snprintf(fname, sizeof(fname), "%ssounds/magic/%s", snprintf(fname, sizeof(fname), "%ssounds/magic/%s",
api->data_directory, kaleidoscope_lens_snd_filenames[i]); api->data_directory, kaleidox_snd_fnames[i]);
snd_effects[i] = Mix_LoadWAV(fname); snd_effects[i] = Mix_LoadWAV(fname);
} }
return (1); return (1);
} }
int kaleidoscope_lens_get_tool_count(magic_api * api ATTRIBUTE_UNUSED) int kaleidox_get_tool_count(magic_api * api ATTRIBUTE_UNUSED)
{ {
return (NUM_TOOLS); return (NUM_TOOLS);
} }
SDL_Surface *kaleidoscope_lens_get_icon(magic_api * api, int which) SDL_Surface *kaleidox_get_icon(magic_api * api, int which)
{ {
char fname[1024]; char fname[1024];
snprintf(fname, sizeof(fname), "%simages/magic/%s", snprintf(fname, sizeof(fname), "%simages/magic/%s",
api->data_directory, kaleidoscope_lens_icon_filenames[which]); api->data_directory, kaleidox_icon_fnames[which]);
return (IMG_Load(fname)); return (IMG_Load(fname));
} }
char *kaleidoscope_lens_get_name(magic_api * api ATTRIBUTE_UNUSED, char *kaleidox_get_name(magic_api * api ATTRIBUTE_UNUSED,
int which) int which)
{ {
return strdup(gettext(kaleidoscope_lens_names[which])); return strdup(gettext(kaleidox_names[which]));
} }
int kaleidoscope_lens_get_group(magic_api * api ATTRIBUTE_UNUSED, int kaleidox_get_group(magic_api * api ATTRIBUTE_UNUSED,
int which ATTRIBUTE_UNUSED) int which ATTRIBUTE_UNUSED)
{ {
return MAGIC_TYPE_PICTURE_WARPS; return MAGIC_TYPE_PICTURE_WARPS;
} }
char *kaleidoscope_lens_get_description(magic_api * api ATTRIBUTE_UNUSED, char *kaleidox_get_description(magic_api * api ATTRIBUTE_UNUSED,
int which, int mode ATTRIBUTE_UNUSED) int which, int mode ATTRIBUTE_UNUSED)
{ {
return strdup(gettext(kaleidoscope_lens_descrs[which])); return strdup(gettext(kaleidox_descrs[which]));
} }
int kaleidoscope_lens_requires_colors(magic_api * api ATTRIBUTE_UNUSED, int kaleidox_requires_colors(magic_api * api ATTRIBUTE_UNUSED,
int which ATTRIBUTE_UNUSED) int which ATTRIBUTE_UNUSED)
{ {
return 0; return 0;
} }
int kaleidoscope_lens_modes(magic_api * api ATTRIBUTE_UNUSED, int kaleidox_modes(magic_api * api ATTRIBUTE_UNUSED,
int which ATTRIBUTE_UNUSED) int which ATTRIBUTE_UNUSED)
{ {
return MODE_PAINT_WITH_PREVIEW; return MODE_PAINT_WITH_PREVIEW;
} }
void kaleidoscope_lens_shutdown(magic_api * api ATTRIBUTE_UNUSED) void kaleidox_shutdown(magic_api * api ATTRIBUTE_UNUSED)
{ {
int i; int i;
@ -155,13 +155,13 @@ void kaleidoscope_lens_shutdown(magic_api * api ATTRIBUTE_UNUSED)
} }
void void
kaleidoscope_lens_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED, kaleidox_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y,
SDL_Rect * update_rect) SDL_Rect * update_rect)
{ {
api->stopsound(); api->stopsound();
kaleidoscope_lens_drag(api, which, canvas, snapshot, x, y, x, y, update_rect); kaleidox_drag(api, which, canvas, snapshot, x, y, x, y, update_rect);
} }
#define linear(start, end, dist, full) (start + (((end - start) * dist) / full)) #define linear(start, end, dist, full) (start + (((end - start) * dist) / full))
@ -189,7 +189,7 @@ int mirror(int n, int max, int flip) {
} }
void void
kaleidoscope_lens_drag(magic_api * api, int which, SDL_Surface * canvas, kaleidox_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED, SDL_Surface * snapshot, int ox ATTRIBUTE_UNUSED, int oy ATTRIBUTE_UNUSED,
int x, int y, SDL_Rect * update_rect) int x, int y, SDL_Rect * update_rect)
{ {
@ -197,7 +197,7 @@ kaleidoscope_lens_drag(magic_api * api, int which, SDL_Surface * canvas,
api->playsound(snd_effects[which], 128, 255); api->playsound(snd_effects[which], 128, 255);
} }
kaleidoscope_lens_render(api, which, canvas, snapshot, x, y, 1); kaleidox_render(api, which, canvas, snapshot, x, y, 1);
update_rect->x = 0; update_rect->x = 0;
update_rect->y = 0; update_rect->y = 0;
@ -205,7 +205,7 @@ kaleidoscope_lens_drag(magic_api * api, int which, SDL_Surface * canvas,
update_rect->h = canvas->h; update_rect->h = canvas->h;
} }
void kaleidoscope_lens_render(magic_api * api, int which, SDL_Surface * canvas, void kaleidox_render(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, int x, int y, int preview) SDL_Surface * snapshot, int x, int y, int preview)
{ {
int off_x, off_y, sides, max_radius; int off_x, off_y, sides, max_radius;
@ -285,13 +285,13 @@ void kaleidoscope_lens_render(magic_api * api, int which, SDL_Surface * canvas,
} }
void kaleidoscope_lens_release(magic_api * api, int which, void kaleidox_release(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * canvas,
SDL_Surface * snapshot, SDL_Surface * snapshot,
int x, int y, int x, int y,
SDL_Rect * update_rect) SDL_Rect * update_rect)
{ {
kaleidoscope_lens_render(api, which, canvas, snapshot, x, y, 0); kaleidox_render(api, which, canvas, snapshot, x, y, 0);
update_rect->x = 0; update_rect->x = 0;
update_rect->y = 0; update_rect->y = 0;
@ -302,7 +302,7 @@ void kaleidoscope_lens_release(magic_api * api, int which,
} }
void kaleidoscope_lens_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, void kaleidox_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED,
SDL_Surface * last ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED,
Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED, Uint8 r ATTRIBUTE_UNUSED, Uint8 g ATTRIBUTE_UNUSED, Uint8 b ATTRIBUTE_UNUSED,
@ -311,13 +311,13 @@ void kaleidoscope_lens_set_color(magic_api * api ATTRIBUTE_UNUSED, int which ATT
} }
void kaleidoscope_lens_switchin(magic_api * api ATTRIBUTE_UNUSED, void kaleidox_switchin(magic_api * api ATTRIBUTE_UNUSED,
int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED) SDL_Surface * canvas ATTRIBUTE_UNUSED)
{ {
} }
void kaleidoscope_lens_switchout(magic_api * api ATTRIBUTE_UNUSED, void kaleidox_switchout(magic_api * api ATTRIBUTE_UNUSED,
int which ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED,
int mode ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED,
SDL_Surface * canvas ATTRIBUTE_UNUSED) SDL_Surface * canvas ATTRIBUTE_UNUSED)