1 {//-------------------------------------------------------------------------}
\r
3 {Copyright (C) 1990, 2009 - Apogee Software, Ltd. }
\r
5 {This file is part of Supernova. Supernova is free software; you can }
\r
6 {redistribute it and/or modify it under the terms of the GNU General Public }
\r
7 {License as published by the Free Software Foundation; either version 2 }
\r
8 {of the License, or (at your option) any later version. }
\r
10 {This program is distributed in the hope that it will be useful, }
\r
11 {but WITHOUT ANY WARRANTY; without even the implied warranty of }
\r
12 {MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. }
\r
14 {See the GNU General Public License for more details. }
\r
16 {You should have received a copy of the GNU General Public License }
\r
17 {along with this program; if not, write to the Free Software }
\r
18 {Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.}
\r
20 {Original Source: 1990 Scott Miller }
\r
21 {Prepared for public release: 03/19/09 - Joe Siegler, Apogee Software, Ltd. }
\r
23 {//-------------------------------------------------------------------------}
\r
29 MaxLength = string[Max];
\r
30 OneChar = string[1];
\r
33 R1, R2 : file of MaxLength;
\r
35 Start,Stop,x : integer;
\r
36 Text1, Text2 : MaxLength;
\r
41 procedure Diskwrite(text1,text2: MaxLength; pointer: integer);
\r
43 seek(R1,pointer); seek(R2,pointer);
\r
44 WRITE(R1,text1); WRITE(R2,text2);
\r
45 writeln('ROOM decription ',pointer,
\r
46 ' is written! Size = ',filesize(R1));
\r
47 close(R1); close(R2);
\r
48 end; {End of Diskwrite.}
\r
50 procedure Diskread(start,stop: integer);
\r
53 text1, text2 : MaxLength;
\r
55 assign(R1,'R1');assign(R2,'R2');
\r
56 reset(R1); reset(R2);
\r
57 seek(R1,start); seek(R2,start);
\r
58 for counter:= start to stop do
\r
61 READ(R1,text1); READ(R2,text2);
\r
64 writeln(lst,'Discription # ',counter);
\r
65 writeln(lst,text1,text2);
\r
69 writeln('Here is ROOM description # ',counter);
\r
71 writeln(text1,text2);
\r
75 close(R1); close(R2);
\r
76 write('The file contains ',filesize(R1),' ROOM descriptions.');
\r
77 end; {End of Diskread.}
\r
81 if(length(text1)in[68,146,224])or(length(text2)in[68,146,224])then
\r
82 begin sound(99);delay(50);nosound;end;
\r
93 writeln('Do you want to R)ead, W)rite or Q)uit?');
\r
95 if upcase(answer) = 'Q' then begin writeln('FINISHED');halt;end;
\r
96 if upcase(answer) <> 'R' then {Write to 'ROOMS'.}
\r
99 assign(R1,'R1'); assign(R2,'R2');
\r
100 textcolor(9);writeln('Now RESETing ROOM files.');highvideo;
\r
101 RESET(R1); RESET(R2);
\r
103 writeln('Input a string not more than ',2*Max,' characters.',
\r
104 ' ''\''-Ends string.');
\r
105 x:=wherey;if(x>17)then x:=18;for stop:=1 to 7 do writeln;gotoxy(1,x);
\r
109 if letter = ^h then
\r
112 begin window(2,1,80,25);gotoxy(79,wherey-1)end;
\r
114 delete(text1,length(text1),2);
\r
118 if (letter <> '\') and (letter <> ^h) then text1:=text1+letter
\r
119 until (length(text1)=Max) or (letter='\');
\r
120 if letter = '\' then
\r
124 writeln('Total of ',length(text1),' characters.');
\r
132 if letter = ^h then
\r
135 begin window(2,1,80,25);gotoxy(79,wherey-1)end;
\r
137 delete(text2,length(text2),2);
\r
141 if (letter <> '\') and (letter <> ^h) then text2:=text2+letter
\r
142 until (length(text2)=Max) or (letter='\');
\r
143 writeln; highvideo;
\r
144 writeln('Total description length = ',
\r
145 length(text1)+length(text2),' characters.');
\r
147 writeln('Now WRITING string to disk.');
\r
148 writeln(' At what position? (Next open is # ',filesize(R1),')');
\r
149 textcolor(12);position:=position+1;readln(position);highvideo;
\r
150 Diskwrite(text1,text2,position);
\r
152 else {Read from 'ROOMS'.}
\r
155 writeln('To the S)creen or the P)rinter');
\r
157 if(upcase(answer)='P')then List:=True else List:=False;
\r
160 writeln('Filesize = ',filesize(R1),
\r
161 ' (From 0 to ',filesize(R1)-1,')');
\r
163 writeln('Enter starting position:');
\r
164 textcolor(12);readln(start);highvideo;
\r
165 if(start > filesize(R1)-5)then stop:=(filesize(R1)-1) else
\r
167 writeln('Enter final position:');
\r
168 textcolor(12);readln(stop);highvideo;
\r
170 Diskread(start,stop);
\r
171 end; {End of else clause.}
\r
172 until false; {End of Main loop.}
\r