fix to not use hardlinks which don't work...
[termux-packages] / packages / frotz / zgames
1 # Lots of resources at: http://www.ifarchive.org/indexes/if-archiveXgamesXzcode.html
2
3 set -e -u
4
5 FG_FOLDER=$HOME/.zgames
6 mkdir -p $FG_FOLDER
7
8 FG_TMPFILE=$FG_FOLDER/tmp
9
10 #--backtitle "Frotz games" \
11 set +e
12 dialog \
13 --title "Select Game" --clear \
14 --radiolist "Select game to play" 0 0 0 \
15 "Adventure" "Welcome to Adventure" off \
16 "Castle Adventure!" "Old-school style" off \
17 "Zork I" "The game that started it all" off \
18 "Zork II" "The next step downward to danger" off \
19 "Zork III" "It all comes down to this" off \
20 "Super Z Trek" "The classic Star Trek" off \
21 "The Hitchhiker's Guide to the Galaxy" "Don't Panic!" off \
22 "zRogue" "Port of the classic game Rogue" off \
23 "Z Racer" "Real-time racing game" off \
24 2> $FG_TMPFILE
25 retval=$?
26 set -e
27 clear
28
29 case $retval in
30 0)
31 FG_GAME=`cat $FG_TMPFILE`;;
32 1)
33 # Cancel pressed
34 exit;;
35 255)
36 # Esc pressed
37 exit;;
38 esac
39
40 case $FG_GAME in
41 "Adventure")
42 FG_FILEDOWNLOAD=http://www.dwheeler.com/adventure/Advent.z5
43 FG_GAMEFOLDER=$FG_FOLDER/adventure;;
44 "Castle Adventure!")
45 FG_FILEDOWNLOAD=http://www.ifarchive.org/if-archive/games/zcode/castle.z8
46 FG_GAMEFOLDER=$FG_FOLDER/castle_adventure;;
47 "Zork I")
48 FG_FILEDOWNLOAD=http://www.infocom-if.org/downloads/zork1.zip
49 FG_GAMEFILE=DATA/ZORK1.DAT
50 FG_GAMEFOLDER=$FG_FOLDER/zork1;;
51 "Zork II")
52 FG_FILEDOWNLOAD=http://www.infocom-if.org/downloads/zork2.zip
53 FG_GAMEFILE=DATA/ZORK2.DAT
54 FG_GAMEFOLDER=$FG_FOLDER/zork2;;
55 "Zork III")
56 FG_FILEDOWNLOAD=http://www.infocom-if.org/downloads/zork3.zip
57 FG_GAMEFILE=DATA/ZORK3.DAT
58 FG_GAMEFOLDER=$FG_FOLDER/zork3;;
59 "Super Z Trek")
60 FG_FILEDOWNLOAD=http://www.ifarchive.org/if-archive/games/zcode/ztrek.z5
61 FG_GAMEFOLDER=$FG_FOLDER/superztrek;;
62 "The Hitchhiker's Guide to the Galaxy")
63 FG_FILEDOWNLOAD=http://www.douglasadams.com/creations/hhgg.z3
64 FG_GAMEFOLDER=$FG_FOLDER/hhgg;;
65 "zRogue")
66 FG_FILEDOWNLOAD=http://www.ifarchive.org/if-archive/games/zcode/rogue.z5
67 FG_GAMEFOLDER=$FG_FOLDER/zrogue;;
68 "Z Racer")
69 FG_FILEDOWNLOAD=http://www.ifarchive.org/if-archive/games/zcode/zracer.z5
70 FG_GAMEFOLDER=$FG_FOLDER/zracer;;
71 *)
72 exit;;
73 esac
74
75 FG_FILENAME=`basename $FG_FILEDOWNLOAD`
76 mkdir -p $FG_GAMEFOLDER/saves
77 cd $FG_GAMEFOLDER
78 if [ ! -f $FG_FILENAME ]; then
79 curl $FG_FILEDOWNLOAD -o $FG_FILENAME
80 if [ "${FG_FILENAME#*.}" = "zip" ]; then
81 unzip $FG_FILENAME;
82 fi
83 fi
84
85 if [ "${FG_FILENAME#*.}" != "zip" ]; then FG_GAMEFILE=`basename $FG_FILEDOWNLOAD`; fi
86
87 cd saves
88 frotz ../$FG_GAMEFILE