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, write to the Free Software
19 ! Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21 Array hghscr_arr -> 7;
22 Array hghscr_tmparr -> 7;
23 [ InitHighScores i j tmp;
24 print "^^[Trying to read highscore file]^";
25 @restore highscore_array 220 highscore_file -> i;
26 ! We couldn't read in the highscore file so we set up a new
29 print "^[Couldn't read highscore file]^^";
30 print "[Please press a key]^"; Read();
33 Nullify(hghscr_tmparr);
34 for (i = 0: i < 10: i++) {
35 for (j = i*22: j < i*22 + 15: j++)
36 highscore_array->j = '-';
38 AddShort(hghscr_arr, hghscr_tmparr, tmp);
39 for (: j < (i+1)*22: j++)
40 highscore_array->j = hghscr_arr->(j - (i*22 + 15));
46 [ AddToHighScore player_name scr_arr i;
47 for (i = 0: i < 10: i++) {
48 LookUpHighScore(tmp_hscr, i);
49 if (CompareLongs(scr_arr, tmp_hscr) > 0) {
50 InsertScoreTable(player_name, scr_arr, i);
56 ! Copies the score at num into hs_array
57 [ LookUpHighScore hs_array num i tmp;
59 for (i = 0: i < 7: i++, tmp++)
60 hs_array->i = highscore_array->tmp;
63 [ InsertScoreTable pl_nm scr_arr num i tmp;
64 ! Shift all lower scores by 22
65 for (i = 219: i >= (num + 1)*22: i--)
66 highscore_array->i = highscore_array->(i - 22);
68 for (i = num*22, tmp = 2: tmp < 17: i++, tmp++)
69 highscore_array->i = pl_nm->tmp;
71 for (i = num*22 + 15, tmp = 0: tmp < 7: i++, tmp++)
72 highscore_array->i = scr_arr->tmp;
83 ! The high score window may overlap
84 ! with some part of a house or snow
86 ClearHighScoreWindow();
90 ClearHighScoreWindow();
94 [ PrintHighScoreName num i;
95 for (i = num*22 : i < num*22 + 15: i++)
96 print (char) highscore_array->i;
99 [ PrintHighScoreNumber num i;
101 ! Right-align numbers
102 while (i < (num+1)*22 - 1 && highscore_array->i == 0) {
103 print (char) ' '; i++;
105 for (: i < (num+1)*22: i++)
106 print highscore_array->i;
109 !------------------ Numbers Juggling -----------------
110 ! Long numbers for calculating and printing out scores
111 ! The long numbers can have up to 7 digits.
113 [ Nullify num_array i;
114 for (i = 0: i < 7: i++)
118 [ CopyArray dest_array src_array i;
119 for (i = 0: i < 7: i++)
120 dest_array->i = src_array->i;
123 ! This appears not to work if dest_array is one of the source arrays
124 [ AddLongs dest_array array1 array2 i tmp plus;
125 for (i = 6, plus = 0: i >= 0: i--) {
126 tmp = array1->i + array2->i;
137 Array short_array -> 7;
138 [ AddShort dest_array num_array num;
139 ShortToArray(short_array, num);
140 AddLongs(dest_array, num_array, short_array);
143 [ ShortToArray num_array num i tmp;
146 for (i = 2, tmp = 10000: i < 7: i++, tmp = tmp/10) {
147 num_array->i = num/tmp;
152 Array mult_array -> 7;
153 Array culm_array -> 7;
154 Array multitmp_array -> 7;
155 [ Multiply dest_array num_array num i j tmp plus;
161 ShortToArray(short_array, num);
163 while (short_array->i == 0) i++;
166 Nullify(multitmp_array);
167 for (j = 6: j >= 0: j--) {
168 tmp = num_array->j * short_array->i;
169 if (plus) tmp = tmp + plus;
177 Shift(mult_array, 6 - i);
178 AddLongs(multitmp_array, culm_array, mult_array);
180 AddLongs(culm_array, multitmp_array, mult_array);
182 CopyArray(dest_array, culm_array);
185 Array shift_array -> 7;
186 [ Shift the_array num i;
187 Nullify(shift_array);
188 for (i = num: i < 7: i++)
189 shift_array->(i-num) = the_array->i;
190 CopyArray(the_array, shift_array);
193 [ CompareLongs array1 array2 i;
194 for (i = 0: i < 7: i++) {
195 if (array1->i < array2->i)
197 if (array1->i > array2->i)
203 [ longnr num_array i;
205 ! Don't print out leading zeroes
206 while (i < 6 && num_array->i == 0)