Maze magic tool - sound effect

This commit is contained in:
Bill Kendrick 2023-01-26 21:57:56 -08:00
parent 49f70c60d8
commit 29a2d148b2
4 changed files with 23 additions and 13 deletions

View file

@ -6,7 +6,7 @@ Copyright (c) 2002-2023
Various contributors (see below, and CHANGES.txt)
https://tuxpaint.org/
June 17, 2002 - January 7, 2023
June 17, 2002 - January 26, 2023
* Design and Coding:
@ -26,7 +26,7 @@ June 17, 2002 - January 7, 2023
Albert Cahalan <albert@users.sf.net>
Bilinear interpolation code based on an example by Christian Graus
( http://www.codeproject.com/cs/media/imageprocessing4.asp ).
(http://www.codeproject.com/cs/media/imageprocessing4.asp)
Input Method (IM) Framework implemented by:
Mark K. Kim <markuskimius@gmail.com>
@ -109,6 +109,12 @@ June 17, 2002 - January 7, 2023
(https://freesound.org/people/MrFossy/sounds/590303/)
Creative Commons 0 license by "MrFossy"
Maze magic tool and artwork
by Bill Kendrick <bill@newbreedsoftware.com>
Maze sound effect: "01-35 Footsteps, Wood, Socks, Running 2.wav"
(https://freesound.org/people/SpliceSound/sounds/369834/)
Creative Commons 0 by Julian Evans <https://www.julianevans.info/>
Mouse accessibility code and keyboard access
Ankit Choudary <ankit.goaldecided@gmail.com>, as part of GSOC 2010,
with integration and fixes by Pere Pujal i Carabantes <pere@fornol.no-ip.org>

View file

@ -26,9 +26,9 @@ https://tuxpaint.org/
- needs sound effect
- effect needs improvement
* [WIP] "Maze"; draw a maze pattern over part or all of
your drawing.
- needs sound effect
* "Maze"; draw a maze pattern over part or all of your drawing.
(Sound effect licensed as Creative Commons 0 by
Julian Evans, https://www.julianevans.info/)
* Improvements to Magic Tools:
----------------------------

BIN
magic/sounds/maze.ogg Normal file

Binary file not shown.

View file

@ -85,10 +85,9 @@ int maze_init(magic_api * api)
{
char fname[1024];
/* FIXME */
// snprintf(fname, sizeof(fname), "%ssounds/magic/maze.ogg",
// api->data_directory);
// snd_effect = Mix_LoadWAV(fname);
snprintf(fname, sizeof(fname), "%ssounds/magic/maze.ogg",
api->data_directory);
snd_effect = Mix_LoadWAV(fname);
return (1);
}
@ -179,10 +178,7 @@ maze_click(magic_api * api, int which, int mode,
return;
if (snd_effect != NULL)
{
api->stopsound();
api->playsound(snd_effect, (x * 255) / canvas->w, 255);
}
maze_start_x = floor(x / MAZE_BLOCK_SIZE) * MAZE_BLOCK_SIZE + (MAZE_BLOCK_SIZE / 2);
maze_start_y = floor(y / MAZE_BLOCK_SIZE) * MAZE_BLOCK_SIZE + (MAZE_BLOCK_SIZE / 2);
@ -201,6 +197,8 @@ maze_click(magic_api * api, int which, int mode,
for (x = 0; x < canvas->w; x++)
maze_color[y * canvas->w + x] = color;
api->playsound(snd_effect, 128, 255);
maze_render(api, canvas);
num_maze_starts = 0;
@ -235,6 +233,9 @@ void maze_release(magic_api * api, int which ATTRIBUTE_UNUSED,
SDL_Surface * canvas, SDL_Surface * snapshot ATTRIBUTE_UNUSED,
int x ATTRIBUTE_UNUSED, int y ATTRIBUTE_UNUSED,
SDL_Rect * update_rect) {
if (snd_effect != NULL)
api->stopsound();
maze_collapse_contiguous(canvas);
maze_add_start();
@ -361,6 +362,9 @@ void maze_line_callback_drag(void *ptr, int which ATTRIBUTE_UNUSED,
int xx, yy, idx;
Uint32 color;
if (snd_effect != NULL)
api->playsound(snd_effect, (x * 255) / canvas->w, 255);
color = SDL_MapRGB(canvas->format, maze_r, maze_g, maze_b);
x = floor(x / (MAZE_BLOCK_SIZE * 3)) * (MAZE_BLOCK_SIZE * 3);