"Rotate" sound effects
This commit is contained in:
parent
23a82cef5a
commit
4ee781c6de
5 changed files with 33 additions and 9 deletions
|
|
@ -6,7 +6,7 @@ Copyright (c) 2002-2024
|
|||
Various contributors (see below, and CHANGES.txt)
|
||||
https://tuxpaint.org/
|
||||
|
||||
June 17, 2002 - September 17, 2024
|
||||
June 17, 2002 - September 24, 2024
|
||||
|
||||
* Design and Coding:
|
||||
|
||||
|
|
@ -189,6 +189,14 @@ June 17, 2002 - September 17, 2024
|
|||
Creative Commons 0 by DigitalUnderglow
|
||||
<https://freesound.org/people/DigitalUnderglow/>
|
||||
|
||||
Rotate magic tool
|
||||
by Bill Kendrick <bill@newbreedsoftware.com>
|
||||
|
||||
Rotate sound effects
|
||||
Sound effects based on "Rotating tank turret planetary electric motor"
|
||||
<https://freesound.org/people/lorefold/sounds/607310/>
|
||||
Creative Commons 0 by lorefold <https://freesound.org/people/lorefold/>
|
||||
|
||||
Bloom magic tool
|
||||
by Bill Kendrick <bill@newbreedsoftware.com>
|
||||
|
||||
|
|
|
|||
|
|
@ -18,8 +18,10 @@ https://tuxpaint.org/
|
|||
+ Closes https://sourceforge.net/p/tuxpaint/feature-requests/257/
|
||||
|
||||
* "Rotate", rotate's the entire image on the canvas.
|
||||
+ Bill Kendrick <bill@newbreedsoftware.com>
|
||||
+ TODO Sound effect
|
||||
+ Code Bill Kendrick <bill@newbreedsoftware.com>
|
||||
+ Sound effects based on "Rotating tank turret planetary electric motor"
|
||||
Creative Commons 0 by lorefold
|
||||
<https://freesound.org/people/lorefold/>
|
||||
+ TODO Icon
|
||||
+ TODO Documentation
|
||||
|
||||
|
|
|
|||
BIN
magic/sounds/rotate-drag.ogg
Normal file
BIN
magic/sounds/rotate-drag.ogg
Normal file
Binary file not shown.
BIN
magic/sounds/rotate-release.ogg
Normal file
BIN
magic/sounds/rotate-release.ogg
Normal file
Binary file not shown.
|
|
@ -32,7 +32,7 @@
|
|||
#include "SDL_mixer.h"
|
||||
#include "SDL2_rotozoom.h"
|
||||
|
||||
static Mix_Chunk *rotate_snd;
|
||||
static Mix_Chunk *rotate_snd_drag, *rotate_snd_release;
|
||||
SDL_Surface * rotate_snapshot = NULL;
|
||||
Uint32 rotate_color;
|
||||
float rotate_last_angle = 0.0;
|
||||
|
|
@ -79,8 +79,11 @@ int rotate_init(magic_api * api, Uint8 disabled_features ATTRIBUTE_UNUSED, Uint8
|
|||
{
|
||||
char fname[1024];
|
||||
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/xor.ogg", api->data_directory); // FIXME
|
||||
rotate_snd = Mix_LoadWAV(fname);
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/rotate-drag.ogg", api->data_directory);
|
||||
rotate_snd_drag = Mix_LoadWAV(fname);
|
||||
|
||||
snprintf(fname, sizeof(fname), "%ssounds/magic/rotate-release.ogg", api->data_directory);
|
||||
rotate_snd_release = Mix_LoadWAV(fname);
|
||||
|
||||
return (1);
|
||||
}
|
||||
|
|
@ -166,7 +169,7 @@ void rotate_drag(magic_api * api, int which ATTRIBUTE_UNUSED, SDL_Surface * canv
|
|||
update_rect->w = canvas->w;
|
||||
update_rect->h = canvas->h;
|
||||
|
||||
api->playsound(rotate_snd, 128, 255);
|
||||
api->playsound(rotate_snd_drag, 128, 255);
|
||||
}
|
||||
|
||||
void rotate_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
||||
|
|
@ -181,6 +184,10 @@ void rotate_click(magic_api * api, int which, int mode ATTRIBUTE_UNUSED,
|
|||
* switching [back] to thsi tool */
|
||||
rotate_clicked_since_switchin = 1;
|
||||
|
||||
/* Stop any sound (in case "release" version is playing),
|
||||
so we can play the main "drag" sound immediately */
|
||||
api->stopsound();
|
||||
|
||||
/* Call the drag function to do the work
|
||||
* (it will add the click positions angle, making it a net
|
||||
* 0-radian rotation _this time_) */
|
||||
|
|
@ -202,12 +209,19 @@ void rotate_release(magic_api * api ATTRIBUTE_UNUSED, int which ATTRIBUTE_UNUSED
|
|||
update_rect->y = 0;
|
||||
update_rect->w = canvas->w;
|
||||
update_rect->h = canvas->h;
|
||||
|
||||
/* Stop any "drag" sound, and play "release" immediately */
|
||||
api->stopsound();
|
||||
api->playsound(rotate_snd_release, 128, 255);
|
||||
}
|
||||
|
||||
void rotate_shutdown(magic_api * api ATTRIBUTE_UNUSED)
|
||||
{
|
||||
if (rotate_snd != NULL)
|
||||
Mix_FreeChunk(rotate_snd);
|
||||
if (rotate_snd_drag != NULL)
|
||||
Mix_FreeChunk(rotate_snd_drag);
|
||||
|
||||
if (rotate_snd_release != NULL)
|
||||
Mix_FreeChunk(rotate_snd_release);
|
||||
|
||||
if (rotate_snapshot != NULL)
|
||||
{
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue