1 ! Z-Tornado - Two player weather action game
3 ! Tornado is copyright (C) 2000-2002 Oliver Feiler
4 ! http://www.lionking.org/~kiza/linux/tornado
5 ! Inform version copyright (c) 2003 Sophie Frühling (sfruehling@aon.at)
7 ! This program is free software; you can redistribute it and/or modify
8 ! it under the terms of the GNU General Public License as published by
9 ! the Free Software Foundation; either version 3 of the License, or
10 ! (at your option) any later version.
12 ! This program is distributed in the hope that it will be useful,
13 ! but WITHOUT ANY WARRANTY; without even the implied warranty of
14 ! MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 ! GNU General Public License for more details.
17 ! You should have received a copy of the GNU General Public License
18 ! along with this program. If not, see <https://www.gnu.org/licenses/>.
20 Array hghscr_arr -> 7;
21 Array hghscr_tmparr -> 7;
22 [ InitHighScores i j tmp;
23 print "^^[Trying to read highscore file]^";
24 @restore highscore_array 220 highscore_file -> i;
25 ! We couldn't read in the highscore file so we set up a new
28 print "^[Couldn't read highscore file]^^";
29 print "[Please press a key]^"; Read();
32 Nullify(hghscr_tmparr);
33 for (i = 0: i < 10: i++) {
34 for (j = i*22: j < i*22 + 15: j++)
35 highscore_array->j = '-';
37 AddShort(hghscr_arr, hghscr_tmparr, tmp);
38 for (: j < (i+1)*22: j++)
39 highscore_array->j = hghscr_arr->(j - (i*22 + 15));
45 [ AddToHighScore player_name scr_arr i;
46 for (i = 0: i < 10: i++) {
47 LookUpHighScore(tmp_hscr, i);
48 if (CompareLongs(scr_arr, tmp_hscr) > 0) {
49 InsertScoreTable(player_name, scr_arr, i);
55 ! Copies the score at num into hs_array
56 [ LookUpHighScore hs_array num i tmp;
58 for (i = 0: i < 7: i++, tmp++)
59 hs_array->i = highscore_array->tmp;
62 [ InsertScoreTable pl_nm scr_arr num i tmp;
63 ! Shift all lower scores by 22
64 for (i = 219: i >= (num + 1)*22: i--)
65 highscore_array->i = highscore_array->(i - 22);
67 for (i = num*22, tmp = 2: tmp < 17: i++, tmp++)
68 highscore_array->i = pl_nm->tmp;
70 for (i = num*22 + 15, tmp = 0: tmp < 7: i++, tmp++)
71 highscore_array->i = scr_arr->tmp;
82 ! The high score window may overlap
83 ! with some part of a house or snow
85 ClearHighScoreWindow();
89 ClearHighScoreWindow();
93 [ PrintHighScoreName num i;
94 for (i = num*22 : i < num*22 + 15: i++)
95 print (char) highscore_array->i;
98 [ PrintHighScoreNumber num i;
100 ! Right-align numbers
101 while (i < (num+1)*22 - 1 && highscore_array->i == 0) {
102 print (char) ' '; i++;
104 for (: i < (num+1)*22: i++)
105 print highscore_array->i;
108 !------------------ Numbers Juggling -----------------
109 ! Long numbers for calculating and printing out scores
110 ! The long numbers can have up to 7 digits.
112 [ Nullify num_array i;
113 for (i = 0: i < 7: i++)
117 [ CopyArray dest_array src_array i;
118 for (i = 0: i < 7: i++)
119 dest_array->i = src_array->i;
122 ! This appears not to work if dest_array is one of the source arrays
123 [ AddLongs dest_array array1 array2 i tmp plus;
124 for (i = 6, plus = 0: i >= 0: i--) {
125 tmp = array1->i + array2->i;
136 Array short_array -> 7;
137 [ AddShort dest_array num_array num;
138 ShortToArray(short_array, num);
139 AddLongs(dest_array, num_array, short_array);
142 [ ShortToArray num_array num i tmp;
145 for (i = 2, tmp = 10000: i < 7: i++, tmp = tmp/10) {
146 num_array->i = num/tmp;
151 Array mult_array -> 7;
152 Array culm_array -> 7;
153 Array multitmp_array -> 7;
154 [ Multiply dest_array num_array num i j tmp plus;
160 ShortToArray(short_array, num);
162 while (short_array->i == 0) i++;
165 Nullify(multitmp_array);
166 for (j = 6: j >= 0: j--) {
167 tmp = num_array->j * short_array->i;
168 if (plus) tmp = tmp + plus;
176 Shift(mult_array, 6 - i);
177 AddLongs(multitmp_array, culm_array, mult_array);
179 AddLongs(culm_array, multitmp_array, mult_array);
181 CopyArray(dest_array, culm_array);
184 Array shift_array -> 7;
185 [ Shift the_array num i;
186 Nullify(shift_array);
187 for (i = num: i < 7: i++)
188 shift_array->(i-num) = the_array->i;
189 CopyArray(the_array, shift_array);
192 [ CompareLongs array1 array2 i;
193 for (i = 0: i < 7: i++) {
194 if (array1->i < array2->i)
196 if (array1->i > array2->i)
202 [ longnr num_array i;
204 ! Don't print out leading zeroes
205 while (i < 6 && num_array->i == 0)