Added sound effect for grass magic tool.

Sound effects are now in stereo.
This commit is contained in:
William Kendrick 2006-02-20 09:54:51 +00:00
parent e404adb2e6
commit c544d42145
8 changed files with 123 additions and 66 deletions

View file

@ -350,7 +350,7 @@ clean:
@echo "Cleaning up the build directory! ($(PWD))" @echo "Cleaning up the build directory! ($(PWD))"
@-rm -f tuxpaint @-rm -f tuxpaint
@-rm -f obj/*.o @-rm -f obj/*.o
@if [ -d obj ]; then rmdir obj; fi @#if [ -d obj ]; then rmdir obj; fi
@-rm -f trans/*.mo @-rm -f trans/*.mo
@if [ -d trans ]; then rmdir trans; fi @if [ -d trans ]; then rmdir trans; fi
@echo @echo
@ -1364,11 +1364,11 @@ trans/wa.mo: src/po/wa.po
@msgfmt -o trans/wa.mo src/po/wa.po @msgfmt -o trans/wa.mo src/po/wa.po
trans/zh_cn.mo: src/po/zh_cn.po trans/zh_cn.mo: src/po/zh_cn.po
@echo " zh_CN ...Chinese..." @echo " zh_CN ...Chinese (Simplified)..."
@msgfmt -o trans/zh_cn.mo src/po/zh_cn.po @msgfmt -o trans/zh_cn.mo src/po/zh_cn.po
trans/zh_tw.mo: src/po/zh_tw.po trans/zh_tw.mo: src/po/zh_tw.po
@echo " zh_TW ...Chinese..." @echo " zh_TW ...Chinese (Traditional)..."
@msgfmt -o trans/zh_tw.mo src/po/zh_tw.po @msgfmt -o trans/zh_tw.mo src/po/zh_tw.po

BIN
data/sounds/grass.wav Normal file

Binary file not shown.

View file

@ -9,7 +9,7 @@ http://www.newbreedsoftware.com/tuxpaint/
$Id$ $Id$
2006.February.19 (0.9.16) 2006.February.20 (0.9.16)
* Interface improvements: * Interface improvements:
----------------------- -----------------------
* Modified "Text" tool so that it correctly handles the 16-bit unicode * Modified "Text" tool so that it correctly handles the 16-bit unicode
@ -35,6 +35,9 @@ $Id$
* Improved some dialog text, including labels for "Yes/No" buttons. * Improved some dialog text, including labels for "Yes/No" buttons.
(Thanks to Vashti for suggestions.) (Thanks to Vashti for suggestions.)
* Sound effects take advantage of stereo. (e.g., paint brush sounds come
more from the left speaker when painting on the left.)
* Tool improvements: * Tool improvements:
------------------------ ------------------------
* Magic Sparkles can now be different colors. * Magic Sparkles can now be different colors.
@ -42,6 +45,8 @@ $Id$
* Magic Negative, Fade, Darken, Tint and Cartoon all now apply with a * Magic Negative, Fade, Darken, Tint and Cartoon all now apply with a
circular shape, rather than a square. circular shape, rather than a square.
* Magic Grass has a sound effect.
* Round erasers added. * Round erasers added.
* Translation Updates: * Translation Updates:

View file

@ -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)
June 14, 2002 - February 18, 2006 June 14, 2002 - February 20, 2006
$Id$ $Id$
*/ */
@ -100,7 +100,7 @@ void do_flood_fill(SDL_Surface * screen, SDL_Surface * canvas, int x, int y, Uin
if ((prog_anim % 4) == 0) if ((prog_anim % 4) == 0)
{ {
show_progress_bar(screen); show_progress_bar(screen);
playsound(0, SND_BUBBLE, 0); playsound(screen, 0, SND_BUBBLE, 0, x, SNDDIST_NEAR);
} }

View file

@ -6,14 +6,56 @@ Mix_Chunk * sounds[NUM_SOUNDS];
#endif #endif
int mute, use_sound; int mute, use_sound;
int old_sound[4] = {-1, -1, -1, -1};
void playsound(int chan, int s, int override) void playsound(SDL_Surface * screen, int chan, int s, int override, int x, int y)
{ {
#ifndef NOSOUND #ifndef NOSOUND
int left, dist;
if (!mute && use_sound && s != SND_NONE) if (!mute && use_sound && s != SND_NONE)
{ {
if (override || !Mix_Playing(chan)) if (override || !Mix_Playing(chan))
{
Mix_PlayChannel(chan, sounds[s], 0); Mix_PlayChannel(chan, sounds[s], 0);
old_sound[chan] = s;
}
if (old_sound[chan] == s)
{
if (y == SNDDIST_NEAR)
dist = 0;
else
{
if (y < 0)
y = 0;
else if (y >= screen->h - 1)
y = screen->h - 1;
dist = (255 * ((screen->h - 1) - y)) / (screen->h - 1);
}
if (x == SNDPOS_LEFT)
left = 255 - dist;
else if (x == SNDPOS_CENTER)
left = (255 - dist) / 2;
else if (x == SNDPOS_RIGHT)
left = 0;
else
{
if (x < 0)
x = 0;
else if (x >= screen->w)
x = screen->w - 1;
left = ((255 - dist) * ((screen->w - 1) - x)) / (screen->w - 1);
}
Mix_SetPanning(chan, left, (255 - dist) - left);
}
} }
#endif #endif
} }

View file

@ -1,13 +1,20 @@
#ifndef PLAYSOUND_H #ifndef PLAYSOUND_H
#define PLAYSOUND_H #define PLAYSOUND_H
#include "SDL.h"
#include "SDL_mixer.h" #include "SDL_mixer.h"
#include "sounds.h" #include "sounds.h"
#define SNDPOS_LEFT -997
#define SNDPOS_CENTER -998
#define SNDPOS_RIGHT -999
#define SNDDIST_NEAR -999
extern Mix_Chunk * sounds[NUM_SOUNDS]; extern Mix_Chunk * sounds[NUM_SOUNDS];
extern int mute, use_sound; extern int mute, use_sound;
void playsound(int chan, int s, int override); void playsound(SDL_Surface * screen, int chan, int s, int override, int x, int y);
#endif #endif

View file

@ -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)
June 15, 2002 - February 18, 2006 June 15, 2002 - February 20, 2006
$Id$ $Id$
*/ */
@ -70,6 +70,7 @@ enum {
SND_TINT, /* Magic tint */ SND_TINT, /* Magic tint */
SND_CARTOON, /* Magic cartoon */ SND_CARTOON, /* Magic cartoon */
SND_BRICK, /* Magic brick */ SND_BRICK, /* Magic brick */
SND_GRASS, /* Magic grass */
SND_KEYCLICK, /* Text tool keyboard click feedback */ SND_KEYCLICK, /* Text tool keyboard click feedback */
SND_KEYCLICKRING, /* Text tool keyboard click feedback with bell ring */ SND_KEYCLICKRING, /* Text tool keyboard click feedback with bell ring */
SND_RETURN, /* Text tool carriage return sound */ SND_RETURN, /* Text tool carriage return sound */
@ -121,6 +122,7 @@ static const char * sound_fnames[NUM_SOUNDS] = {
DATA_PREFIX "sounds/tint.wav", DATA_PREFIX "sounds/tint.wav",
DATA_PREFIX "sounds/cartoon.wav", DATA_PREFIX "sounds/cartoon.wav",
DATA_PREFIX "sounds/brick.wav", DATA_PREFIX "sounds/brick.wav",
DATA_PREFIX "sounds/grass.wav",
DATA_PREFIX "sounds/keyclick.wav", DATA_PREFIX "sounds/keyclick.wav",
DATA_PREFIX "sounds/typewriterbell.wav", DATA_PREFIX "sounds/typewriterbell.wav",
DATA_PREFIX "sounds/return.wav", DATA_PREFIX "sounds/return.wav",

View file

@ -22,7 +22,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)
June 14, 2002 - February 19, 2006 June 14, 2002 - February 20, 2006
$Id$ $Id$
*/ */
@ -1256,7 +1256,7 @@ int main(int argc, char * argv[])
update_screen_rect(&dest); update_screen_rect(&dest);
do_setcursor(cursor_arrow); do_setcursor(cursor_arrow);
playsound(0, SND_HARP, 1); playsound(screen, 0, SND_HARP, 1, SNDPOS_CENTER, SNDDIST_NEAR);
do_wait(50); // about 5 seconds do_wait(50); // about 5 seconds
@ -1598,7 +1598,7 @@ static void mainloop(void)
file_id[0] = '\0'; file_id[0] = '\0';
starter_id[0] = '\0'; starter_id[0] = '\0';
playsound(1, SND_HARP, 1); playsound(screen, 1, SND_HARP, 1, SNDPOS_CENTER, SNDDIST_NEAR);
} }
else else
{ {
@ -1648,7 +1648,7 @@ static void mainloop(void)
{ {
texttool_len--; texttool_len--;
texttool_str[texttool_len] = 0; texttool_str[texttool_len] = 0;
playsound(0, SND_KEYCLICK, 0); playsound(screen, 0, SND_KEYCLICK, 0, SNDPOS_CENTER, SNDDIST_NEAR);
do_render_cur_text(0); do_render_cur_text(0);
} }
@ -1670,7 +1670,7 @@ static void mainloop(void)
cursor_x = cursor_left; cursor_x = cursor_left;
cursor_y = min(cursor_y+font_height, canvas->h-font_height); cursor_y = min(cursor_y+font_height, canvas->h-font_height);
playsound(0, SND_RETURN, 1); playsound(screen, 0, SND_RETURN, 1, SNDPOS_RIGHT, SNDDIST_NEAR);
} }
else if (key_down == SDLK_TAB) else if (key_down == SDLK_TAB)
{ {
@ -1703,11 +1703,14 @@ static void mainloop(void)
if (cursor_x + old_cursor_textwidth <= canvas->w - 50 && if (cursor_x + old_cursor_textwidth <= canvas->w - 50 &&
cursor_x + cursor_textwidth > canvas->w - 50) cursor_x + cursor_textwidth > canvas->w - 50)
{ {
playsound(0, SND_KEYCLICKRING, 1); playsound(screen, 0, SND_KEYCLICKRING, 1, SNDPOS_RIGHT, SNDDIST_NEAR);
} }
else else
{ {
playsound(0, SND_KEYCLICK, 0); /* FIXME: Might be fun to position the
sound based on keyboard layout...? */
playsound(screen, 0, SND_KEYCLICK, 0, SNDPOS_CENTER, SNDDIST_NEAR);
} }
} }
} }
@ -1778,7 +1781,7 @@ static void mainloop(void)
draw_toolbar(); draw_toolbar();
update_screen_rect(&r_tools); update_screen_rect(&r_tools);
playsound(1, SND_CLICK, 0); playsound(screen, 1, SND_CLICK, 0, SNDPOS_LEFT, SNDDIST_NEAR);
// FIXME: this "if" is just plain gross // FIXME: this "if" is just plain gross
if(cur_tool != TOOL_TEXT) if(cur_tool != TOOL_TEXT)
@ -1990,7 +1993,7 @@ static void mainloop(void)
file_id[0] = '\0'; file_id[0] = '\0';
starter_id[0] = '\0'; starter_id[0] = '\0';
playsound(1, SND_HARP, 1); playsound(screen, 1, SND_HARP, 1, SNDPOS_CENTER, SNDDIST_NEAR);
} }
else else
{ {
@ -2130,7 +2133,7 @@ static void mainloop(void)
#ifndef NOSOUND #ifndef NOSOUND
if (cur_tool != TOOL_STAMP || stamp_data[which]->ssnd == NULL) if (cur_tool != TOOL_STAMP || stamp_data[which]->ssnd == NULL)
{ {
playsound(1, SND_BLEEP, 0); playsound(screen, 1, SND_BLEEP, 0, SNDPOS_RIGHT, SNDDIST_NEAR);
} }
#endif #endif
old_thing = cur_thing; old_thing = cur_thing;
@ -2207,7 +2210,7 @@ static void mainloop(void)
} }
if (control_sound != -1) if (control_sound != -1)
{ {
playsound(0, control_sound, 0); playsound(screen, 0, control_sound, 0, SNDPOS_CENTER, SNDDIST_NEAR);
draw_stamps(); draw_stamps();
update_screen_rect(&r_toolopt); update_screen_rect(&r_toolopt);
set_active_stamp(); set_active_stamp();
@ -2279,7 +2282,7 @@ static void mainloop(void)
if (control_sound != -1) if (control_sound != -1)
{ {
playsound(0, control_sound, 0); playsound(screen, 0, control_sound, 0, SNDPOS_CENTER, SNDDIST_NEAR);
if (cur_tool == TOOL_TEXT) // Huh? It had better be! if (cur_tool == TOOL_TEXT) // Huh? It had better be!
@ -2313,7 +2316,7 @@ static void mainloop(void)
{ {
*thing_scroll += is_upper ? -gd_items.cols : gd_items.cols; *thing_scroll += is_upper ? -gd_items.cols : gd_items.cols;
do_draw = 1; do_draw = 1;
playsound(1, SND_SCROLL, 1); playsound(screen, 1, SND_SCROLL, 1, SNDPOS_RIGHT, SNDDIST_NEAR);
if (!scrolling) if (!scrolling)
{ {
memcpy(&scrolltimer_event, &event, sizeof(SDL_Event)); memcpy(&scrolltimer_event, &event, sizeof(SDL_Event));
@ -2448,7 +2451,7 @@ static void mainloop(void)
if (which >= 0 && which < NUM_COLORS) if (which >= 0 && which < NUM_COLORS)
{ {
cur_color = which; cur_color = which;
playsound(1, SND_BUBBLE, 1); playsound(screen, 1, SND_BUBBLE, 1, event.button.x, SNDDIST_NEAR);
draw_colors(COLORSEL_REFRESH); draw_colors(COLORSEL_REFRESH);
render_brush(); render_brush();
render_sparkles(); render_sparkles();
@ -2487,7 +2490,7 @@ static void mainloop(void)
brush_counter = 999; brush_counter = 999;
brush_draw(old_x, old_y, old_x, old_y, 1); brush_draw(old_x, old_y, old_x, old_y, 1);
playsound(0, SND_PAINT1 + (img_cur_brush->w) / 12, 1); playsound(screen, 0, SND_PAINT1 + (img_cur_brush->w) / 12, 1, event.button.x, SNDDIST_NEAR);
} }
else if (cur_tool == TOOL_STAMP) else if (cur_tool == TOOL_STAMP)
{ {
@ -2497,7 +2500,7 @@ static void mainloop(void)
stamp_draw(old_x, old_y); stamp_draw(old_x, old_y);
stamp_xor(old_x, old_y); stamp_xor(old_x, old_y);
playsound(1, SND_STAMP, 1); playsound(screen, 1, SND_STAMP, 1, event.button.x, SNDDIST_NEAR);
draw_tux_text(TUX_GREAT, great_str(), 1); draw_tux_text(TUX_GREAT, great_str(), 1);
@ -2519,7 +2522,7 @@ static void mainloop(void)
brush_draw(old_x, old_y, old_x, old_y, 1); brush_draw(old_x, old_y, old_x, old_y, 1);
playsound(1, SND_LINE_START, 1); playsound(screen, 1, SND_LINE_START, 1, event.button.x, SNDDIST_NEAR);
draw_tux_text(TUX_BORED, TIP_LINE_START, 1); draw_tux_text(TUX_BORED, TIP_LINE_START, 1);
} }
else if (cur_tool == TOOL_SHAPES) else if (cur_tool == TOOL_SHAPES)
@ -2535,7 +2538,7 @@ static void mainloop(void)
shape_tool_mode = SHAPE_TOOL_MODE_STRETCH; shape_tool_mode = SHAPE_TOOL_MODE_STRETCH;
playsound(1, SND_LINE_START, 1); playsound(screen, 1, SND_LINE_START, 1, event.button.x, SNDDIST_NEAR);
draw_tux_text(TUX_BORED, TIP_SHAPE_START, 1); draw_tux_text(TUX_BORED, TIP_SHAPE_START, 1);
} }
else if (shape_tool_mode == SHAPE_TOOL_MODE_ROTATE) else if (shape_tool_mode == SHAPE_TOOL_MODE_ROTATE)
@ -2545,7 +2548,7 @@ static void mainloop(void)
/* (Arbitrarily large...) */ /* (Arbitrarily large...) */
brush_counter = 999; brush_counter = 999;
playsound(1, SND_LINE_END, 1); playsound(screen, 1, SND_LINE_END, 1, event.button.x, SNDDIST_NEAR);
do_shape(shape_ctr_x, shape_ctr_y, do_shape(shape_ctr_x, shape_ctr_y,
shape_outer_x, shape_outer_y, shape_outer_x, shape_outer_y,
rotation(shape_ctr_x, shape_ctr_y, rotation(shape_ctr_x, shape_ctr_y,
@ -2714,7 +2717,7 @@ static void mainloop(void)
{ {
*thing_scroll += is_upper ? -gd_items.cols : gd_items.cols; *thing_scroll += is_upper ? -gd_items.cols : gd_items.cols;
do_draw = 1; do_draw = 1;
playsound(1, SND_SCROLL, 1); playsound(screen, 1, SND_SCROLL, 1, SNDPOS_RIGHT, SNDDIST_NEAR);
#if 0 #if 0
if (!scrolling) if (!scrolling)
{ {
@ -2825,7 +2828,7 @@ static void mainloop(void)
brush_draw(event.button.x-r_canvas.x, event.button.y-r_canvas.y, brush_draw(event.button.x-r_canvas.x, event.button.y-r_canvas.y,
event.button.x-r_canvas.x, event.button.y-r_canvas.y, 1); event.button.x-r_canvas.x, event.button.y-r_canvas.y, 1);
playsound(1, SND_LINE_END, 1); playsound(screen, 1, SND_LINE_END, 1, event.button.x, SNDDIST_NEAR);
draw_tux_text(TUX_GREAT, tool_tips[TOOL_LINES], 1); draw_tux_text(TUX_GREAT, tool_tips[TOOL_LINES], 1);
} }
else if (cur_tool == TOOL_SHAPES) else if (cur_tool == TOOL_SHAPES)
@ -2858,7 +2861,7 @@ static void mainloop(void)
shape_outer_x, shape_outer_y), shape_outer_x, shape_outer_y),
0); 0);
playsound(1, SND_LINE_START, 1); playsound(screen, 1, SND_LINE_START, 1, event.button.x, SNDDIST_NEAR);
draw_tux_text(TUX_BORED, TIP_SHAPE_NEXT, 1); draw_tux_text(TUX_BORED, TIP_SHAPE_NEXT, 1);
@ -2871,7 +2874,7 @@ static void mainloop(void)
brush_counter = 999; /* arbitrarily large... */ brush_counter = 999; /* arbitrarily large... */
playsound(1, SND_LINE_END, 1); playsound(screen, 1, SND_LINE_END, 1, event.button.x, SNDDIST_NEAR);
do_shape(shape_ctr_x, shape_ctr_y, do_shape(shape_ctr_x, shape_ctr_y,
shape_outer_x, shape_outer_y, shape_outer_x, shape_outer_y,
0, 1); 0, 1);
@ -3029,7 +3032,7 @@ static void mainloop(void)
brush_draw(old_x, old_y, new_x, new_y, 1); brush_draw(old_x, old_y, new_x, new_y, 1);
playsound(0, SND_PAINT1 + (img_cur_brush->w) / 12, 0); playsound(screen, 0, SND_PAINT1 + (img_cur_brush->w) / 12, 0, event.button.x, SNDDIST_NEAR);
} }
else if (cur_tool == TOOL_LINES) else if (cur_tool == TOOL_LINES)
{ {
@ -3896,37 +3899,35 @@ static void magic_draw(int x1, int y1, int x2, int y2, int button_down)
/* Play sound: */ /* Play sound: */
if (cur_magic == MAGIC_DRIP) if (cur_magic == MAGIC_DRIP)
playsound(0, SND_DRIP, 0); playsound(screen, 0, SND_DRIP, 0, x1, SNDDIST_NEAR);
else if (cur_magic == MAGIC_CHALK) else if (cur_magic == MAGIC_CHALK)
playsound(0, SND_CHALK, 0); playsound(screen, 0, SND_CHALK, 0, x1, SNDDIST_NEAR);
else if (cur_magic == MAGIC_SPARKLES) else if (cur_magic == MAGIC_SPARKLES)
playsound(0, SND_SPARKLES1 + (rand() % 2), 0); playsound(screen, 0, SND_SPARKLES1 + (rand() % 2), 0, x1, SNDDIST_NEAR);
else if (cur_magic == MAGIC_FLIP) else if (cur_magic == MAGIC_FLIP)
playsound(0, SND_FLIP, 0); playsound(screen, 0, SND_FLIP, 0, SNDPOS_CENTER, SNDDIST_NEAR);
else if (cur_magic == MAGIC_MIRROR) else if (cur_magic == MAGIC_MIRROR)
playsound(0, SND_MIRROR, 0); playsound(screen, 0, SND_MIRROR, 0, SNDPOS_CENTER, SNDDIST_NEAR);
else if (cur_magic == MAGIC_NEGATIVE) else if (cur_magic == MAGIC_NEGATIVE)
playsound(0, SND_NEGATIVE, 0); playsound(screen, 0, SND_NEGATIVE, 0, x1, SNDDIST_NEAR);
else if (cur_magic == MAGIC_BLUR) else if (cur_magic == MAGIC_BLUR)
playsound(0, SND_BLUR, 0); playsound(screen, 0, SND_BLUR, 0, x1, SNDDIST_NEAR);
else if (cur_magic == MAGIC_BLOCKS && ((rand() % 10) < 5)) else if (cur_magic == MAGIC_BLOCKS && ((rand() % 10) < 5))
playsound(0, SND_BLOCKS, 0); playsound(screen, 0, SND_BLOCKS, 0, x1, SNDDIST_NEAR);
else if (cur_magic == MAGIC_FADE) else if (cur_magic == MAGIC_FADE)
playsound(0, SND_FADE, 0); playsound(screen, 0, SND_FADE, 0, x1, SNDDIST_NEAR);
else if (cur_magic == MAGIC_DARKEN) else if (cur_magic == MAGIC_DARKEN)
playsound(0, SND_DARKEN, 0); playsound(screen, 0, SND_DARKEN, 0, x1, SNDDIST_NEAR);
else if (cur_magic == MAGIC_RAINBOW) else if (cur_magic == MAGIC_RAINBOW)
playsound(0, SND_RAINBOW, 0); playsound(screen, 0, SND_RAINBOW, 0, x1, SNDDIST_NEAR);
else if (cur_magic == MAGIC_SMUDGE) else if (cur_magic == MAGIC_SMUDGE)
playsound(0, SND_SMUDGE, 0); playsound(screen, 0, SND_SMUDGE, 0, x1, SNDDIST_NEAR);
else if (cur_magic == MAGIC_CARTOON) else if (cur_magic == MAGIC_CARTOON)
playsound(0, SND_CARTOON, 0); playsound(screen, 0, SND_CARTOON, 0, x1, SNDDIST_NEAR);
else if (cur_magic == MAGIC_TINT) else if (cur_magic == MAGIC_TINT)
playsound(0, SND_TINT, 0); playsound(screen, 0, SND_TINT, 0, x1, SNDDIST_NEAR);
else if (cur_magic == MAGIC_GRASS)
/* FIXME: Need sounds for: playsound(screen, 0, SND_GRASS, 0, x1, y1);
Grass (mower?) */
/* FIXME: Arbitrary? */ /* FIXME: Arbitrary? */
@ -3979,7 +3980,7 @@ static void do_brick(int x, int y, int w, int h)
/* Note: We only play the brick sound when we actually DRAW a brick: */ /* Note: We only play the brick sound when we actually DRAW a brick: */
playsound(0, SND_BRICK, 1); playsound(screen, 0, SND_BRICK, 1, x, SNDDIST_NEAR);
} }
/* Draw the current brush in the current color: */ /* Draw the current brush in the current color: */
@ -8556,7 +8557,7 @@ static void do_eraser(int x, int y)
{ {
eraser_sound = (eraser_sound + 1) % 2; eraser_sound = (eraser_sound + 1) % 2;
playsound(0, SND_ERASER1 + eraser_sound, 0); playsound(screen, 0, SND_ERASER1 + eraser_sound, 0, x, SNDDIST_NEAR);
} }
} }
#endif #endif
@ -9761,8 +9762,8 @@ static int do_prompt_image_flash_snd(const char * const text, const char * const
/* Draw button box: */ /* Draw button box: */
playsound(0, SND_PROMPT, 1); playsound(screen, 0, SND_PROMPT, 1, SNDPOS_CENTER, SNDDIST_NEAR);
playsound(1, snd, 1); playsound(screen, 1, snd, 1, SNDPOS_LEFT, SNDDIST_NEAR);
for (w = 0; w <= 96; w = w + 4) for (w = 0; w <= 96; w = w + 4)
{ {
@ -10791,7 +10792,7 @@ static int do_save(void)
{ {
/* Ta-Da! */ /* Ta-Da! */
playsound(0, SND_SAVE, 1); playsound(screen, 0, SND_SAVE, 1, SNDPOS_CENTER, SNDDIST_NEAR);
draw_tux_text(TUX_DEFAULT, tool_tips[TOOL_SAVE], 1); draw_tux_text(TUX_DEFAULT, tool_tips[TOOL_SAVE], 1);
} }
#else #else
@ -10884,7 +10885,7 @@ static int do_save(void)
/* All happy! */ /* All happy! */
playsound(0, SND_SAVE, 1); playsound(screen, 0, SND_SAVE, 1, SNDPOS_CENTER, SNDDIST_NEAR);
draw_tux_text(TUX_DEFAULT, tool_tips[TOOL_SAVE], 1); draw_tux_text(TUX_DEFAULT, tool_tips[TOOL_SAVE], 1);
do_setcursor(cursor_arrow); do_setcursor(cursor_arrow);
@ -11771,7 +11772,7 @@ void do_open(void)
/* Open */ /* Open */
done = 1; done = 1;
playsound(1, SND_CLICK, 1); playsound(screen, 1, SND_CLICK, 1, SNDPOS_LEFT, SNDDIST_NEAR);
} }
else if (key == SDLK_ESCAPE) else if (key == SDLK_ESCAPE)
{ {
@ -11779,7 +11780,7 @@ void do_open(void)
which = -1; which = -1;
done = 1; done = 1;
playsound(1, SND_CLICK, 1); playsound(screen, 1, SND_CLICK, 1, SNDPOS_RIGHT, SNDDIST_NEAR);
} }
else if (key == SDLK_d && else if (key == SDLK_d &&
(event.key.keysym.mod & KMOD_CTRL) && (event.key.keysym.mod & KMOD_CTRL) &&
@ -11805,7 +11806,7 @@ void do_open(void)
if (which < num_files) if (which < num_files)
{ {
playsound(1, SND_BLEEP, 1); playsound(screen, 1, SND_BLEEP, 1, event.button.x, SNDDIST_NEAR);
update_list = 1; update_list = 1;
@ -11834,7 +11835,7 @@ void do_open(void)
{ {
cur = cur - 4; cur = cur - 4;
update_list = 1; update_list = 1;
playsound(1, SND_SCROLL, 1); playsound(screen, 1, SND_SCROLL, 1, SNDPOS_CENTER, SNDDIST_NEAR);
if (cur == 0) if (cur == 0)
do_setcursor(cursor_arrow); do_setcursor(cursor_arrow);
@ -11852,7 +11853,7 @@ void do_open(void)
{ {
cur = cur + 4; cur = cur + 4;
update_list = 1; update_list = 1;
playsound(1, SND_SCROLL, 1); playsound(screen, 1, SND_SCROLL, 1, SNDPOS_CENTER, SNDDIST_NEAR);
if (cur >= num_files - 16) if (cur >= num_files - 16)
do_setcursor(cursor_arrow); do_setcursor(cursor_arrow);
@ -11869,7 +11870,7 @@ void do_open(void)
/* Open */ /* Open */
done = 1; done = 1;
playsound(1, SND_CLICK, 1); playsound(screen, 1, SND_CLICK, 1, SNDPOS_LEFT, SNDDIST_NEAR);
} }
else if (event.button.x >= (WINDOW_WIDTH - 96 - 48) && else if (event.button.x >= (WINDOW_WIDTH - 96 - 48) &&
event.button.x < (WINDOW_WIDTH - 96) && event.button.x < (WINDOW_WIDTH - 96) &&
@ -11880,7 +11881,7 @@ void do_open(void)
which = -1; which = -1;
done = 1; done = 1;
playsound(1, SND_CLICK, 1); playsound(screen, 1, SND_CLICK, 1, SNDPOS_RIGHT, SNDDIST_NEAR);
} }
else if (event.button.x >= (WINDOW_WIDTH - 96 - 48 - 48) && else if (event.button.x >= (WINDOW_WIDTH - 96 - 48 - 48) &&
event.button.x < (WINDOW_WIDTH - 48 - 96) && event.button.x < (WINDOW_WIDTH - 48 - 96) &&
@ -11904,7 +11905,7 @@ void do_open(void)
{ {
cur = cur - 4; cur = cur - 4;
update_list = 1; update_list = 1;
playsound(1, SND_SCROLL, 1); playsound(screen, 1, SND_SCROLL, 1, SNDPOS_CENTER, SNDDIST_NEAR);
if (cur == 0) if (cur == 0)
do_setcursor(cursor_arrow); do_setcursor(cursor_arrow);
@ -11916,7 +11917,7 @@ void do_open(void)
{ {
cur = cur + 4; cur = cur + 4;
update_list = 1; update_list = 1;
playsound(1, SND_SCROLL, 1); playsound(screen, 1, SND_SCROLL, 1, SNDPOS_CENTER, SNDDIST_NEAR);
if (cur >= num_files - 16) if (cur >= num_files - 16)
do_setcursor(cursor_arrow); do_setcursor(cursor_arrow);