If brush is too big, it would play an incorrect sound. Now clipping array index.
This commit is contained in:
parent
5cfe84153c
commit
d08b50e36f
1 changed files with 11 additions and 2 deletions
|
|
@ -1200,6 +1200,7 @@ static void mirror_starter(void);
|
||||||
static void flip_starter(void);
|
static void flip_starter(void);
|
||||||
int valid_click(Uint8 button);
|
int valid_click(Uint8 button);
|
||||||
int in_circle(int x, int y);
|
int in_circle(int x, int y);
|
||||||
|
int paintsound(int size);
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
static char *debug_gettext(const char *str);
|
static char *debug_gettext(const char *str);
|
||||||
|
|
@ -2656,7 +2657,7 @@ static void mainloop(void)
|
||||||
reset_brush_counter();
|
reset_brush_counter();
|
||||||
|
|
||||||
brush_draw(old_x, old_y, old_x, old_y, 1);
|
brush_draw(old_x, old_y, old_x, old_y, 1);
|
||||||
playsound(screen, 0, SND_PAINT1 + (img_cur_brush_w) / 12, 1,
|
playsound(screen, 0, paintsound(img_cur_brush_w), 1,
|
||||||
event.button.x, SNDDIST_NEAR);
|
event.button.x, SNDDIST_NEAR);
|
||||||
}
|
}
|
||||||
else if (cur_tool == TOOL_STAMP)
|
else if (cur_tool == TOOL_STAMP)
|
||||||
|
|
@ -3209,7 +3210,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(screen, 0, SND_PAINT1 + (img_cur_brush_w) / 12, 0,
|
playsound(screen, 0, paintsound(img_cur_brush_w), 0,
|
||||||
event.button.x, SNDDIST_NEAR);
|
event.button.x, SNDDIST_NEAR);
|
||||||
}
|
}
|
||||||
else if (cur_tool == TOOL_LINES)
|
else if (cur_tool == TOOL_LINES)
|
||||||
|
|
@ -15188,3 +15189,11 @@ int in_circle(int x, int y)
|
||||||
else
|
else
|
||||||
return (0);
|
return (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int paintsound(int size)
|
||||||
|
{
|
||||||
|
if (SND_PAINT1 + (size / 12) >= SND_PAINT4)
|
||||||
|
return(SND_PAINT4);
|
||||||
|
else
|
||||||
|
return(SND_PAINT1 + (size / 12));
|
||||||
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue