#!/bin/sh
#
# 9/5/2024
#
# playsounds
# Used with spacegame2 to play sounds
#
# run on Linux using 'watch -n .5 playsounds.sh'
#
# 4/24/2024 Explosion sound doesn't always play from game
#           debugging this
#           4/28/2024 added dt
# 5/22/2024 added ship lost sound to when planet is taken over since it was missing
# 9/5/2024  added Ship x in r,c can now be recharged!
#
#

FN=playsounds.txt

if [ -f $FN ] ; then

 x=`cat $FN`

 case $x in

  1) play -q boop.wav ;;                         # Terran ship creation

  2) play -q warning.wav ;;                      # Ship has arrived at its destination in x,y

  3) play -q warning.wav ;;                      # Ship has arrived at planet in ...

  4) play -q warning.wav ;;                      # Timer has expired in quadrant

  5) echo 5        ;;                            # Terran ship 62 under attack in quadrant     was 0.au

  6) play -q 4.au  ;;                            # Alien ship close to Terran planet at

  7) echo 7        ;;                            # Ship 64 in quadrant 4,7 has not fired back!   this doesn't work

  8) play -q warning.wav ;;                      # Conditions favorable for Doomship creation!

  9) play -q glasses.wav ;;                      # Doom ship has entered the galaxy

 10) play -q glasses.wav ;;                      # Doom ship detected! Quadrant: x,y

 11) play -q glasses.wav ;;                      # Doom ship in quadrant! Power: xxxx

 12) echo 12 ;;                                  # Alien ship heading to Terran3 at

 13) echo 13 ;;                                  # Sensors detect a cloaked ship in quad:

 14) play -q boop.wav ;;                         # New ship at 4,3 Auto-Nav to

 15) echo 15 ;;                                  # Ship 38 on course to planet ...

 16) echo 16 ;;                                  # Alien ship near Terran planet has been decloaked!

 17) echo 17 ;;                                  # Cannot bomb planet with (alien name) ships in quadrant.

 18) play -q warning.wav ;;                      # Error setting Auto-Nav!

 19) echo 19 ;;                                  # The Terrans have visited all of the quadrants!

 20) play -q 9.au ;;                             # Quadrant 2,1 has become empty

 21) play -q glasses.wav ;;                      # The Dark Quadrant has been converted!

 22) echo 22 ;;                                  # The (alien name) race has been destroyed!

 23) echo 23 ;;                                  # Ship on course to planet!

 24) echo 24 ;;                                  # Terran shields very low!

 25) play -q beam.wav ;;                         # Terran ship destroyed!

 26) play -q explos.wav                          # Firing bombs at planet! Success!   This is played in SG2

     dt >> j1.txt                                # 4/28/2024

     ;;

 27) echo 27 ;;                                  # # Alien ship heading to undefended planet ...

 28) play -q warning.wav ;;                      # TU is now:

 29) play -q beam.wav ;;                         # player planet taken over


#  30) play -q mars.au    ;;                     # opening screen music

 31) play -q warning.wav ;;                      # 9/5/2024 Ship x in r,c can now be recharged!




 esac

 cp p50.txt $FN

 echo "Done."

fi


