Dither sound effects

This commit is contained in:
Bill Kendrick 2024-03-19 23:33:31 -07:00
parent ef3f150a88
commit 3bf36f8c07
5 changed files with 23 additions and 7 deletions

View file

@ -6,7 +6,7 @@ Copyright (c) 2002-2024
Various contributors (see below, and CHANGES.txt) Various contributors (see below, and CHANGES.txt)
https://tuxpaint.org/ https://tuxpaint.org/
June 17, 2002 - January 13, 2024 June 17, 2002 - March 19, 2024
* Design and Coding: * Design and Coding:
@ -141,6 +141,13 @@ June 17, 2002 - January 13, 2024
(https://freesound.org/people/Kawgrim/sounds/584865/) (https://freesound.org/people/Kawgrim/sounds/584865/)
Creative Commons 0 by Kawgrim <https://freesound.org/people/Kawgrim/> Creative Commons 0 by Kawgrim <https://freesound.org/people/Kawgrim/>
Dither & Dither (Keep Color) magic tools and artwork
by Bill Kendrick <bill@newbreedsoftware.com>
Dither & Dither (Keep Color) sound effects based on "Orion FIll.wav"
(https://freesound.org/people/KatHakaku/sounds/54112/)
Creative Commons 0 by KatHakaku <https://freesound.org/people/KatHakaku/>
Bloom magic tool Bloom magic tool
by Bill Kendrick <bill@newbreedsoftware.com> by Bill Kendrick <bill@newbreedsoftware.com>
Googly Eyes sound effect: "Torch Crackle.wav" Googly Eyes sound effect: "Torch Crackle.wav"

View file

@ -17,12 +17,13 @@ https://tuxpaint.org/
+ WIP Needs icon + WIP Needs icon
+ WIP Needs sound effect + WIP Needs sound effect
* WIP Dither & Dither (Keep Color): Replaces all or part of a drawing * Dither & Dither (Keep Color): Replaces all or part of a drawing
with dithered X-and-white pixels. With "Dither", X is always black, with dithered X-and-white pixels. With "Dither", X is always black,
or the currently-selected color; with "Dither (Keep Color)", X is or the currently-selected color; with "Dither (Keep Color)", X is
a muted version of the original color. a muted version of the original color.
Bill Kendrick <bill@newbreedsoftware.com> Bill Kendrick <bill@newbreedsoftware.com>
+ WIP Needs sound effect - Sound effects based on "Orion FIll.wav", Creative Commons 0
by KatHakaku <https://freesound.org/people/KatHakaku/>
* Improvements to Eraser tool: * Improvements to Eraser tool:
---------------------------- ----------------------------

BIN
magic/sounds/dither.ogg Normal file

Binary file not shown.

Binary file not shown.

View file

@ -50,8 +50,8 @@ char * dither_icon_filenames[NUM_TOOLS] = {
}; };
char * dither_snd_filenames[NUM_TOOLS] = { char * dither_snd_filenames[NUM_TOOLS] = {
"reflection.ogg", // FIXME "dither.ogg",
"reflection.ogg", // FIXME "dither_keep_color.ogg",
}; };
Mix_Chunk *snd_effects[NUM_TOOLS]; Mix_Chunk *snd_effects[NUM_TOOLS];
@ -65,6 +65,8 @@ Uint8 dither_sizes[NUM_TOOLS];
Uint32 dither_white, dither_black, dither_color; Uint32 dither_white, dither_black, dither_color;
Uint8 * dither_touched; Uint8 * dither_touched;
float * dither_vals; float * dither_vals;
int dither_click_mode;
void dither_drag(magic_api * api, int which, SDL_Surface * canvas, void dither_drag(magic_api * api, int which, SDL_Surface * canvas,
SDL_Surface * snapshot, int old_x, int old_y, int x, int y, SDL_Surface * snapshot, int old_x, int old_y, int x, int y,
@ -137,7 +139,7 @@ char *dither_get_description(magic_api * api, int which, int mode)
{ {
if (mode == MODE_PAINT) { if (mode == MODE_PAINT) {
return strdup(gettext(dither_descr[which][0])); return strdup(gettext(dither_descr[which][0]));
} else if (mode == MODE_FULLSCREEN) { } else /* if (mode == MODE_FULLSCREEN) */ {
return strdup(gettext(dither_descr[which][1])); return strdup(gettext(dither_descr[which][1]));
} }
} }
@ -193,7 +195,6 @@ void dither_shutdown(magic_api * api)
} }
} }
void void
dither_click(magic_api * api, int which, int mode, dither_click(magic_api * api, int which, int mode,
SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y, SDL_Surface * canvas, SDL_Surface * snapshot, int x, int y,
@ -202,6 +203,8 @@ dither_click(magic_api * api, int which, int mode,
int xx, yy; int xx, yy;
Uint8 r, g, b; Uint8 r, g, b;
dither_click_mode = mode;
for (yy = 0; yy < canvas->h; yy++) for (yy = 0; yy < canvas->h; yy++)
{ {
for (xx = 0; xx < canvas->w; xx++) for (xx = 0; xx < canvas->w; xx++)
@ -231,6 +234,7 @@ dither_click(magic_api * api, int which, int mode,
} }
else else
{ {
api->playsound(snd_effects[which], 128, 255);
dither_release(api, which, canvas, snapshot, x, y, update_rect); dither_release(api, which, canvas, snapshot, x, y, update_rect);
} }
} }
@ -351,6 +355,10 @@ dither_release(magic_api * api, int which,
update_rect->y = 0; update_rect->y = 0;
update_rect->w = canvas->w; update_rect->w = canvas->w;
update_rect->h = canvas->h; update_rect->h = canvas->h;
if (dither_click_mode == MODE_PAINT) {
api->stopsound();
}
} }
void dither_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect) void dither_set_color(magic_api * api, int which, SDL_Surface * canvas, SDL_Surface * snapshot, Uint8 r, Uint8 g, Uint8 b, SDL_Rect * update_rect)