Subversion Repositories Games.Chess Giants

Rev

Rev 11 | Rev 116 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 11 Rev 18
Line 17... Line 17...
17
   // do we have a sound to play ? if so, play it
17
   // do we have a sound to play ? if so, play it
18
   if (queued_sound != 0)
18
   if (queued_sound != 0)
19
   {
19
   {
20
      // given the type of sound we want, enqueue the right one
20
      // given the type of sound we want, enqueue the right one
21
      if (queued_sound == SOUNDTYPE_CLICK)
21
      if (queued_sound == SOUNDTYPE_CLICK)
22
         swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/data/sounds/click.wav", app_path);
22
         swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/themes/%s/sounds/click.wav", app_path, theme->name);
23
      else if (queued_sound == SOUNDTYPE_ILLEGALMOVE)
23
      else if (queued_sound == SOUNDTYPE_ILLEGALMOVE)
24
         swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/data/sounds/illegal.wav", app_path);
24
         swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/themes/%s/sounds/illegal.wav", app_path, theme->name);
25
      else if (queued_sound == SOUNDTYPE_VICTORY)
25
      else if (queued_sound == SOUNDTYPE_VICTORY)
26
         swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/data/sounds/win.wav", app_path);
26
         swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/themes/%s/sounds/win.wav", app_path, theme->name);
27
      else if (queued_sound == SOUNDTYPE_DEFEAT)
27
      else if (queued_sound == SOUNDTYPE_DEFEAT)
28
         swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/data/sounds/lose.wav", app_path);
28
         swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/themes/%s/sounds/lose.wav", app_path, theme->name);
29
      else if (queued_sound == SOUNDTYPE_CHECK)
29
      else if (queued_sound == SOUNDTYPE_CHECK)
30
         swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/data/sounds/check.wav", app_path);
30
         swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/themes/%s/sounds/check.wav", app_path, theme->name);
31
      else if (queued_sound == SOUNDTYPE_PIECETAKEN)
31
      else if (queued_sound == SOUNDTYPE_PIECETAKEN)
32
         swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/data/sounds/take.wav", app_path);
32
         swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/themes/%s/sounds/take.wav", app_path, theme->name);
33
      else if (queued_sound == SOUNDTYPE_MOVE)
33
      else if (queued_sound == SOUNDTYPE_MOVE)
34
      {
34
      {
35
         sound_index = rand () % 6; // there are several movement sounds, pick one at random
35
         sound_index = rand () % 6; // there are several movement sounds, pick one at random
36
         if (sound_index == 0)
36
         if (sound_index == 0)
37
            swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/data/sounds/move1.wav", app_path);
37
            swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/themes/%s/sounds/move1.wav", app_path, theme->name);
38
         else if (sound_index == 1)
38
         else if (sound_index == 1)
39
            swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/data/sounds/move2.wav", app_path);
39
            swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/themes/%s/sounds/move2.wav", app_path, theme->name);
40
         else if (sound_index == 2)
40
         else if (sound_index == 2)
41
            swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/data/sounds/move3.wav", app_path);
41
            swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/themes/%s/sounds/move3.wav", app_path, theme->name);
42
         else if (sound_index == 3)
42
         else if (sound_index == 3)
43
            swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/data/sounds/move4.wav", app_path);
43
            swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/themes/%s/sounds/move4.wav", app_path, theme->name);
44
         else if (sound_index == 4)
44
         else if (sound_index == 4)
45
            swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/data/sounds/move5.wav", app_path);
45
            swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/themes/%s/sounds/move5.wav", app_path, theme->name);
46
         else
46
         else
47
            swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/data/sounds/move6.wav", app_path);
47
            swprintf_s (soundfile_path, WCHAR_SIZEOF (soundfile_path), L"%s/themes/%s/sounds/move6.wav", app_path, theme->name);
48
      }
48
      }
49
 
49
 
50
      PlaySound (soundfile_path, NULL, SND_ASYNC | SND_FILENAME | SND_NODEFAULT);
50
      PlaySound (soundfile_path, NULL, SND_ASYNC | SND_FILENAME | SND_NODEFAULT);
51
      queued_sound = 0; // play this sound then forget it
51
      queued_sound = 0; // play this sound then forget it
52
   }
52
   }