Foam: Update for new API, always circular; new SFX

Never change aspect ratio of bubble image used by Foam.
New sound effect, CC-0 by https://freesound.org/people/ristooooo1
This commit is contained in:
Bill Kendrick 2023-04-20 23:49:14 -07:00
parent 4e54ad7704
commit 1d8e64362b
4 changed files with 48 additions and 8 deletions

View file

@ -113,6 +113,12 @@ June 17, 2002 - April 20, 2023
(https://freesound.org/people/MrFossy/sounds/590303/)
Creative Commons 0 license by "MrFossy"
Foam magic tool and artwork
by Bill Kendrick <bill@newbreedsoftware.com>
Foam sound effect: "Bubbles » Bubbles 004.wav"
(https://freesound.org/people/ristooooo1/sounds/539819/)
Creative Commons 0 license by "ristooooo1"
Maze magic tool and artwork
by Bill Kendrick <bill@newbreedsoftware.com>
Maze sound effect: "01-35 Footsteps, Wood, Socks, Running 2.wav"

View file

@ -40,6 +40,7 @@ https://tuxpaint.org/
+ Bricks
+ Clone
+ Confetti
+ Foam
+ Googly Eyes
+ Light
+ Metal Paint
@ -60,6 +61,13 @@ https://tuxpaint.org/
* Clone performance improved.
Bill Kendrick <bill@newbreedsoftware.com>
* Foam bubbles now always appear circular.
Bill Kendrick <bill@newbreedsoftware.com>
* New Foam sound effect.
(Sound effect licensed as Creative Commons 0 by
https://freesound.org/people/ristooooo1)
* Other Improvements:
-------------------
* Word-wrap long button labels, for better readability.

Binary file not shown.

View file

@ -23,7 +23,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
(See COPYING.txt)
Last updated: February 12, 2023
Last updated: April 20, 2023
*/
#include <stdio.h>
@ -42,11 +42,12 @@ static int *foam_mask, *foam_mask_tmp;
static SDL_Surface *foam_7, *foam_5, *foam_3, *foam_1;
Uint32 foam_api_version(void);
int foam_init(magic_api * api);
int foam_init(magic_api * api, Uint32 disabled_features);
char *foam_get_description(magic_api * api, int which, int mode);
void foam_release(magic_api * api, int which,
SDL_Surface * canvas, SDL_Surface * last, int x, int y,
SDL_Rect * update_rect);
void foam_release_worker(SDL_Surface * canvas, SDL_Surface* last, SDL_Rect * update_rect);
void foam_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * last, int ox, int oy, int x, int y,
SDL_Rect * update_rect);
@ -67,6 +68,9 @@ void foam_shutdown(magic_api * api);
int foam_get_tool_count(magic_api * api);
int foam_modes(magic_api * api, int which);
int foam_requires_colors(magic_api * api, int which);
Uint8 foam_accepted_sizes(magic_api * api, int which, int mode);
Uint8 foam_default_size(magic_api * api, int which, int mode);
void foam_set_size(magic_api * api, int which, int mode, SDL_Surface * canvas, SDL_Surface * last, Uint8 size, SDL_Rect * update_rect);
#define FOAM_PROP 8
#define FOAM_RADIUS 3
@ -78,7 +82,7 @@ Uint32 foam_api_version(void)
// No setup required:
int foam_init(magic_api * api)
int foam_init(magic_api * api, Uint32 disabled_features ATTRIBUTE_UNUSED)
{
char fname[1024];
SDL_Surface *foam_data;
@ -93,16 +97,16 @@ int foam_init(magic_api * api)
foam_7 =
api->scale(foam_data, ((api->canvas_w / FOAM_PROP) * 4) / 4,
((api->canvas_h / FOAM_PROP) * 4) / 4, 0);
((api->canvas_h / FOAM_PROP) * 4) / 4, 1);
foam_5 =
api->scale(foam_data, ((api->canvas_w / FOAM_PROP) * 3) / 4,
((api->canvas_h / FOAM_PROP) * 3) / 4, 0);
((api->canvas_h / FOAM_PROP) * 3) / 4, 1);
foam_3 =
api->scale(foam_data, ((api->canvas_w / FOAM_PROP) * 2) / 4,
((api->canvas_h / FOAM_PROP) * 2) / 4, 0);
((api->canvas_h / FOAM_PROP) * 2) / 4, 1);
foam_1 =
api->scale(foam_data, ((api->canvas_w / FOAM_PROP) * 1) / 4,
((api->canvas_h / FOAM_PROP) * 1) / 4, 0);
((api->canvas_h / FOAM_PROP) * 1) / 4, 1);
SDL_FreeSurface(foam_data);
@ -186,7 +190,8 @@ void foam_drag(magic_api * api, int which, SDL_Surface * canvas,
{
api->line((void *) api, which, canvas, last, ox, oy, x, y, 1, do_foam);
foam_release(api, which, canvas, last, x, y, update_rect);
foam_release_worker(canvas, last, update_rect);
// foam_release(api, which, canvas, last, x, y, update_rect);
/* FIXME */
if (ox > x)
@ -262,6 +267,12 @@ void foam_release(magic_api * api ATTRIBUTE_UNUSED ATTRIBUTE_UNUSED,
int which ATTRIBUTE_UNUSED, SDL_Surface * canvas,
SDL_Surface * last, int x ATTRIBUTE_UNUSED,
int y ATTRIBUTE_UNUSED, SDL_Rect * update_rect)
{
api->stopsound();
foam_release_worker(canvas, last, update_rect);
}
void foam_release_worker(SDL_Surface * canvas, SDL_Surface* last, SDL_Rect * update_rect)
{
int xx, yy;
int changes, max_iters;
@ -491,3 +502,18 @@ int foam_modes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED)
{
return (MODE_PAINT);
}
Uint8 foam_accepted_sizes(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{
return 0;
}
Uint8 foam_default_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED)
{
return 0;
}
void foam_set_size(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED, SDL_Surface * canvas ATTRIBUTE_UNUSED, SDL_Surface * last ATTRIBUTE_UNUSED, Uint8 size ATTRIBUTE_UNUSED, SDL_Rect * update_rect ATTRIBUTE_UNUSED)
{
}