home *** CD-ROM | disk | FTP | other *** search
-
- {TITLE.PA2}
-
- { SetColors }
-
- PROCEDURE SetColors(Sen : s);
-
- FUNCTION ColorNumber(ColorName : words) : Integer;
- VAR TempNum : Integer;
- BEGIN
- TempNum := -1; {default value for errors, mis-spellings, etc.}
- IF ColorName = 'BLACK' THEN TempNum := BLACK;
- IF ColorName = 'GREEN' THEN TempNum := GREEN;
- IF ColorName = 'CYAN' THEN TempNum := CYAN;
- IF ColorName = 'RED' THEN TempNum := RED;
- IF ColorName = 'MAGENTA' THEN TempNum := MAGENTA;
- IF ColorName = 'BROWN' THEN TempNum := BROWN;
- IF ColorName = 'LIGHTGRAY' THEN TempNum := LIGHTGRAY;
- IF ColorName = 'DARKGRAY' THEN TempNum := DARKGRAY;
- IF ColorName = 'LIGHTBLUE' THEN TempNum := LIGHTBLUE;
- IF ColorName = 'LIGHTGREEN' THEN TempNum := LIGHTGREEN;
- IF ColorName = 'LIGHTCYAN' THEN TempNum := LIGHTCYAN;
- IF ColorName = 'LIGHTRED' THEN TempNum := LIGHTRED;
- IF ColorName = 'LIGHTMAGENTA' THEN TempNum := LIGHTMAGENTA;
- IF ColorName = 'YELLOW' THEN TempNum := YELLOW;
- IF ColorName = 'WHITE' THEN TempNum := WHITE;
- IF ColorName = 'BLUE' THEN TempNum := BLUE;
- ColorNumber := TempNum;
- END; {ColorNumber}
-
- LABEL Done;
- VAR TempWord : words;
- TempSen : s;
- TempNum : Integer;
- Spot : Integer;
-
- BEGIN {SetColors}
- TempSen := Sen;
- {set default colors -- depending on type of screen adapter}
- IF (DisplayMode = Mono) OR (POS('MONO', TempSen) <> 0)
- THEN BEGIN {Mono}
- NormalTextColor := LIGHTGRAY;
- NormalTextBackground := BLACK;
- HighLightTextColor := WHITE;
- ReverseTextColor := BLACK;
- ReverseTextBackground := LIGHTGRAY;
- END
- ELSE IF (POS('DEFAULT', TempSen) <> 0)
- THEN BEGIN {Default Colors}
- NormalTextColor := 3; {Cyan}
- NormalTextBackground := 0; {Black}
- HighLightTextColor := 14; {Yellow}
- ReverseTextColor := 4; {Red}
- ReverseTextBackground := 7; {LightGray}
- END
- ELSE BEGIN {Specifing Color Combination of some sort}
- TempSen := But_First(TempSen); {Strip off 'COLOR(S)'}
- TempWord := first_word(TempSen);
- IF TempWord = '' THEN GOTO Done;
- TempNum := ColorNumber(TempWord);
- IF TempNum = -1 THEN GOTO Done;
- NormalTextColor := TempNum MOD 16;
- TempSen := But_First(TempSen);
- TempWord := first_word(TempSen);
- IF TempWord = '' THEN GOTO Done;
- TempNum := ColorNumber(TempWord);
- IF TempNum = -1 THEN GOTO Done;
- HighLightTextColor := TempNum MOD 16;
- TempSen := But_First(TempSen);
- TempWord := first_word(TempSen);
- IF TempWord = '' THEN GOTO Done;
- TempNum := ColorNumber(TempWord);
- IF TempNum = -1 THEN GOTO Done;
- NormalTextBackground := TempNum MOD 8;
- TempSen := But_First(TempSen);
- TempWord := first_word(TempSen);
- IF TempWord = '' THEN GOTO Done;
- TempNum := ColorNumber(TempWord);
- IF TempNum = -1 THEN GOTO Done;
- ReverseTextColor := TempNum MOD 16;
- TempSen := But_First(TempSen);
- TempWord := first_word(TempSen);
- IF TempWord = '' THEN GOTO Done;
- TempNum := ColorNumber(TempWord);
- IF TempNum = -1 THEN GOTO Done;
- ReverseTextBackground := TempNum MOD 8;
- END; {color}
- Done:
- END; {SetColors}
-
-
- PROCEDURE CheckForColor(VAR sentence : s);
- VAR Temp : s;
- BEGIN
- Temp := sentence;
- Capitalize(Temp);
- IF POS('COLOR', Temp) <> 0
- THEN BEGIN
- SetColors(Temp);
- sentence := ''; {Return nil sentence instead of COLOR info}
- END;
- END; {CheckForColor}
-
-
- { Title }
- {Print the title screen: }
- {First, if the user has provided a }
- {file TITLE.TTL, display that, pausing}
- {if necessary. Then, print the AGT }
- {copyright/credit information. }
-
- PROCEDURE Title;
-
- { Center }
- {Write the string of text centered}
- {on an 80-column display. }
-
- PROCEDURE center(st : s);
- CONST Blanks = ' ';
- VAR i : Integer;
- BEGIN
- IF morecount >= 23 THEN BEGIN
- Pause;
- morecount := 0;
- END;
- {delete leading blanks}
- IF Length(st) > 1 THEN WHILE st[1] = ' ' DO
- st := Copy(st, 2, Length(st)-1);
- FOR i := 1 TO Length(st) DO {Swap # and solid block of color}
- IF st[i] = '#' THEN st[i] := Chr(219);
- Write(IO, Copy(Blanks, 1, (80-Length(st)) DIV 2));
- WriteLn(IO, st);
- morecount := morecount+1;
- END; {center}
-
- CONST
- {$IFDEF NormalVersion}
- cw1 = 'The Adventure Game Toolkit (AGT) 1.7';
- {$ELSE}
- cw1 = 'The BIG Adventure Game Toolkit (AGT) 1.7';
- {$ENDIF}
- cw2 = 'Copyright 1994 -- All Rights Reserved';
- cw3 = 'by David R. Malmberg and Mark J. Welch';
- cw4 = 'AGT is distributed as "Freeware" and you are free to use it as you wish.';
-
- VAR titlefile : Text;
- sentence, TempSen : s;
- w, LowStr, HighStr, TempWord : words;
- fn : Text;
- DataFileBytes, CmdFileBytes, MinTime, MaxTime : Real;
- LowMin, HighMin, TempNum : Integer;
- datafile : FILE;
- BEGIN {title}
- {set default colors -- depending on type of screen adapter}
- Word_Chars := ['0'..'9', 'A'..'Z', 'a'..'z', '-', '_'];
- {Necessary for first_word and But_First to work properly}
- SetColors('DEFAULT');
- Scripting := False; {turn off -- to start}
- WriteLn(IO, ' ');
- morecount := 1;
- w := title_file_name;
- IF (File_Exists(w)) THEN
- BEGIN
- Assign(titlefile, w);
- Reset(titlefile);
- ReadLn(titlefile, sentence);
- CheckForColor(sentence); {COLOR command should be in first line of file}
- CLRSCR; {clear the screen so nothing distracts user from title}
- highlight; {use highlighted colors for actual title}
- CLRSCR;
- IF NOT EOF(titlefile) THEN
- REPEAT
- IF sentence = ''
- THEN WriteLn
- ELSE center(sentence);
- ReadLn(titlefile, sentence);
- CheckForColor(sentence);
- highlight; {if COLOR has changed}
- UNTIL (sentence = 'END OF FILE') OR EOF(titlefile);
- Close(titlefile);
- END; {if title file exists then}
- normal; {use normal colors}
- WriteLn(IO, ' ');
- morecount := morecount+1;
- center('Created using: '+cw1);
- center(cw2);
- center(cw3);
- Write(IO, ' ');
- center(cw4);
- Write(IO, ' ');
- morecount := morecount+2;
- DELAY(5000); {give user at least 5 seconds to read title}
- IF UsingFinalVersion
- THEN center('Reading data, please wait (should take 10 to 15 seconds)');
- morecount := 1; {initialization will take enough time to read screen}
- END; {title}
-
-