home *** CD-ROM | disk | FTP | other *** search
- (*========================================================*)
- (* Otashi.Pas Version 2.11 *)
- (* (C) 1991 Volkmar Stegmann und toolbox *)
- (*--------------------------------------------------------*)
- (* Programmart: Grafik-Knobelspiel *)
- (* System: MS-/PC-/DR-DOS ab 3.00, *)
- (* OS/2-Kompatibilitätsbox *)
- (* Compiler: Turbo Pascal ab V. 4.00 *)
- (* benöt. Units: Drivers, Fonts bzw. BGIDriv, BGIFont *)
- (* für Turbo4 DOS_50 aus Toolbox 12'89 *)
- (* Grafik: EGA, VGA, Hercules *)
- (* Hardware: PC-XT/AT, Zwei- oder Dreitasten-Maus *)
- (*========================================================*)
-
- {$B-,D+,L+,F-,I-,N-,R-,S+,V-,M 16384,0,655360}
- {$IFDEF VER60} {$X+,G-} {$ENDIF}
- {$IFNDEF VER40} {$A-,E-,O-,L+} {$ENDIF}
- {.$DEFINE internaldrivers} {bedingte Einbindung des Trei- }
- {$DEFINE internalfonts} {bers und der Fonts in den Code}
- PROGRAM Otashi;
-
- USES
- {$IFDEF VER60} {Turbo Pascal 6.0}
- {$IFDEF internaldrivers} BGIDriv, {$ENDIF}
- {$IFDEF internalfonts} BGIFont, {$ENDIF}
- {$ELSE} {Turbo Pascal 4.0 bis 5.5}
- {$IFDEF internaldrivers} Drivers, {$ENDIF}
- {$IFDEF internalfonts} Fonts, {$ENDIF}
- {$ENDIF}
- Crt, Dos,
- {$IFDEF VER40} DOS_50, {$ENDIF}
- Graph;
-
- TYPE
- String21 = STRING[21];
- RegisterSet = RECORD
- AX, BX, CX, DX, BP, DI, SI, DS, ES, Flags: INTEGER
- END;
- Array16 = ARRAY[1..6] OF INTEGER;
-
- CONST
- SStack : Array16 = (1, 8, 15, 22, 29, 36);
- Pos1 : Array16 = (1, 12, 1, 12, 6, 7);
- Pos2 : Array16 = (1, 1, 8, 8, 4, 5);
- FileHeader : String21 = #8'Otashi Score Liste'#0#26;
- DoneFlag : BOOLEAN = FALSE;
- version : STRING[7] = 'V. 2.11';
-
- VAR
- ScoreFile : PathStr;
- ScoreFileDir : DirStr;
- ScoreFileName : NameStr;
- ScoreFileExt : ExtStr;
- i, j, Taste, Reihe, w,
- n, u, s, t, x, y, z, q,
- GraphDriver, GraphMode,
- Reg1, Reg2, Reg3, Reg4,
- XOld, YOld, XPos, YPos : INTEGER;
- mode : ^BYTE;
- Farben, Bilder : ARRAY[0..36] OF INTEGER;
- Stack : ARRAY[1..72] OF INTEGER;
- HStack : ARRAY[-2..36] OF BYTE;
- Punkte : LONGINT;
- Feld : ARRAY[0..13, 0..9] OF INTEGER;
- Farbe, Fill : Array16;
- Size : WORD;
- b, a : String21;
- Name : ARRAY[1..6] OF STRING[15];
- tp : ARRAY[1..6] OF LONGINT;
- Punkt : ARRAY[1..6] OF STRING[6];
- Back2, Back : Pointer;
- Stein : ARRAY[1..36] OF Pointer;
- sr : SearchRec;
- Safe : FILE OF String21;
- MonoMonitor, MenuFlag : BOOLEAN;
-
- (*--------------------------------------------------------*)
-
- PROCEDURE GrundMuster(r: INTEGER);
- { zeichnet das Grundmodell eines Steines }
- BEGIN
- SetColor(White);
- Rectangle(0, 0, 40, 40);
- SetFillStyle(Fill[r], Farbe[r]);
- FloodFill(1, 1, White);
- SetFillStyle(SolidFill, Black);
- PieSlice(20, 20, 0, 360, 18);
- SetColor(Black); Line(20, 20, 37, 20); SetColor(White);
- Circle(20, 20, 18); Circle(20, 20, 16);
- END;
-
- (*--------------------------------------------------------*)
-
- PROCEDURE Muster(e, r: INTEGER);
- { zeichnet eines der sechs Muster in den Stein }
- BEGIN
- CASE e OF
- 1: BEGIN
- GrundMuster(r);
- Arc(20, 14, 90, 270, 8); Arc(20, 26, 270, 90, 8);
- Circle(20, 14, 3); Circle(20, 26, 3);
- SetFillStyle(SolidFill, White);
- FloodFill(25, 14, White); FloodFill(20, 26, White);
- SetColor(Black); Circle(20, 14, 3); SetColor(Cyan);
- END;
- 2: BEGIN
- GrundMuster(r);
- Circle(12, 20, 8); Circle(28, 20, 8);
- Circle(12, 20, 3); Circle(28, 20, 3);
- SetFillStyle(SolidFill, White);
- FloodFill(6, 25, White); FloodFill(28, 25, White);
- SetColor(Black);
- Circle(28, 20, 3);
- SetColor(Cyan);
- END;
- 3: BEGIN
- GrundMuster(r);
- Arc(20, 14, 90, 270, 8); Arc(20, 26, 270, 90, 8);
- Arc(12, 20, 180, 360, 8); Arc(28, 20, 360, 180, 8);
- END;
- 4: BEGIN
- GrundMuster(r); SetFillStyle(SolidFill, White);
- r := 0;
- REPEAT
- PieSlice(20, 20, r, r + 10, 16); Inc(r, 30);
- UNTIL r > 360;
- END;
- 5: BEGIN
- GrundMuster(r);
- Ellipse(20, 20, 0, 360, 16, 8);
- Ellipse(20, 20, 0, 360, 8, 8);
- SetFillStyle(SolidFill, Black);
- FloodFill( 7, 20, White); FloodFill(33, 20, White);
- FloodFill(20, 14, White); FloodFill(20, 26, White);
- {$IFNDEF VER40}
- FillEllipse(20, 20, 3, 3);
- {$ELSE}
- SetFillStyle(SolidFill, White);
- Circle(20, 20, 3);
- Circle(20, 20, 8);
- SetFillStyle(SolidFill, Black);
- {$ENDIF}
- END;
- 6: BEGIN
- GrundMuster(r);
- Circle(20, 20, 10); Circle(12, 20, 8);
- Circle(28, 20, 8); Circle(20, 14, 8);
- Circle(20, 26, 8); SetFillStyle(SolidFill, Black);
- FloodFill(12, 20, White); FloodFill(28, 20, White);
- FloodFill(20, 14, White); FloodFill(20, 26, White);
- END;
- END;
- END;
-
- (*--------------------------------------------------------*)
-
- PROCEDURE SteinGrafiken;
- { zeichnet alle möglichen Steine und speichert sie ab }
- VAR
- farbe, graf: INTEGER;
- BEGIN
- SetActivePage(1);
- FOR farbe := 1 TO 6 DO BEGIN
- FOR graf := 1 TO 6 DO BEGIN
- Muster(graf, farbe);
- Size := ImageSize(0, 0, 40, 40);
- GetMem(Stein[(Pred(farbe)) * 6 + graf], Size);
- GetImage(0, 0, 40, 40,
- Stein[(Pred(farbe)) * 6 + graf]^);
- Farben[(Pred(farbe)) * 6 + graf] := farbe;
- Bilder[(Pred(farbe)) * 6 + graf] := graf;
- ClearViewPort;
- END;
- END;
- GetMem(Back, Size);
- SetActivePage(0); Farben[0] := 0; Bilder[0] := 0;
- END;
-
- (*--------------------------------------------------------*)
-
- PROCEDURE HelpMouse(VAR Reg1, Reg2, Reg3, Reg4: INTEGER);
- { Hilfsroutine für die Mausabfrage }
- VAR
- Reg : Registers;
- BEGIN
- WITH Reg DO BEGIN
- AX := WORD(Reg1); BX := WORD(Reg2);
- CX := WORD(Reg3); DX := WORD(Reg4);
- Intr(51, Reg);
- Reg1 := INTEGER(AX); Reg2 := INTEGER(BX);
- Reg3 := INTEGER(CX); Reg4 := INTEGER(DX);
- END;
- END;
-
- (*--------------------------------------------------------*)
-
- PROCEDURE MouseCursor;
- { stellt den Mauscursor auf dem Bildschirm dar und fragt }
- { die Maustasten ab }
- VAR
- t : BOOLEAN;
- ch: CHAR;
-
- PROCEDURE Help;
- { Hilfedisplay, das mit F1 aufgerufen werden kann }
- VAR
- lr, i: INTEGER;
- ti : TextSettingsType;
- ch : CHAR;
- BEGIN
- IF mode^ = HercMono THEN lr := 59 ELSE lr := 19;
- SetActivePage(0); SetVisualPage(0); GetTextSettings(ti);
- IF NOT DoneFlag THEN BEGIN
- DoneFlag := TRUE; ClearViewPort;
- FOR i := 5 DOWNTO 0 DO BEGIN
- SetColor(Farbe[6 - i]);
- Rectangle(Succ(i), Succ(i),
- GetMaxX - 2 * i, GetMaxY - 2 * i);
- END;
- SetTextStyle(TriplexFont, HorizDir, 4);
- SetTextJustify(CenterText, CenterText);
- SetColor(Yellow);
- OutTextXY(GetMaxX DIV 2, 24,
- 'Regeln von O T A S H I');
- SetColor(White);
- SetTextJustify(ti.Horiz, ti.Vert);
- SetTextStyle(DefaultFont, HorizDir, 1);
- OutTextXY(lr, 69, '1. Es dürfen niemals identische S'
- + 'teine nebeneinander gelegt werden'
- + '.');
- OutTextXY(lr, 89, '2. Plaziert man einen Stein so au'
- + 'f dem Spielfeld, daß er an keinen'
- + ' anderen');
- OutTextXY(lr, 99, ' Stein angrenzt, hat man nicht'
- + 's weiter zu beachten. Es lassen '
- + 'sich so');
- OutTextXY(lr, 109, ' auf einfachste Weise 100 Punkt'
- + 'e erzielen.');
- OutTextXY(lr, 129, '3. Komplizierter wird es, wenn m'
- + 'an seinen Stein neben einen ander'
- + 'en legt.');
- OutTextXY(lr, 139, ' Hierbei darf jeweils nur das'
- + ' Symbol oder die Farbe mit dem '
- + ' anderen');
- OutTextXY(lr, 149, ' Stein übereinstimmen, nicht be'
- + 'ides. Für einen solchen Zug gibt'
- + ' es dann');
- OutTextXY(lr, 159, ' schon 400 Punkte.');
- OutTextXY(lr, 179, '4. Legt man den Stein an zwei an'
- + 'dere Steine an, so muß beim e'
- + 'inen die');
- OutTextXY(lr, 189, ' Farbe und beim anderen das Sy'
- + 'mbol übereinstimmen, nicht aber'
- + ' beides.');
- OutTextXY(lr, 199, ' Dafür gibt es 800 Punkte.');
- OutTextXY(lr, 219, '5. Legt man einen Stein an drei a'
- + 'ndere Steine an, so gilt folgende'
- + 's:');
- OutTextXY(lr, 229, ' Eine gleiche Farbe und zwei '
- + 'gleiche Symbole oder umgekehrt. '
- + ' Gleiche');
- OutTextXY(lr, 239, ' Steine dürfen auch hierbei '
- + 'nicht aneinandergelegt werden. '
- + ' Da eine');
- OutTextXY(lr, 249, ' solche Plazierung schon ziemli'
- + 'ch selten ist, gibt''s gleich 200'
- + '0 Punkte.');
- OutTextXY(lr, 269, '6. Wem das noch nicht genug ist, '
- + ' der kann ja versuchen, seinen'
- + ' Stein an');
- OutTextXY(lr, 279, ' vier andere Steine anzulegen.'
- + ' Dabei muß zweimal die Farbe und'
- + ' zweimal');
- OutTextXY(lr, 289, ' das Symbol übereinstimmen. Gle'
- + 'iche Steine können nicht angelegt'
- + ' werden.');
- OutTextXY(lr, 299, ' Hierfür gibt es satte 5000 Pun'
- + 'kte.');
- END;
- REPEAT
- ch := ReadKey; IF ch = Chr(0) THEN ch := ReadKey;
- UNTIL ch <> Chr(0);
- SetTextStyle(ti.Font, ti.Direction, ti.CharSize);
- SetActivePage(1); SetVisualPage(1);
- END; { Help }
-
- BEGIN
- t := TRUE;
- GetImage(XPos, YPos, XPos + 40, YPos + 40, Back^);
- REPEAT
- Reg1 := 3; HelpMouse(Reg1, Reg2, Reg3, Reg4);
- IF (XPos <> Reg3) OR (YOld <> Reg4) OR (t = TRUE) THEN
- BEGIN
- PutImage(XPos, YPos, Back^, NormalPut);
- XOld := 0; YOld := Reg4; XPos := Reg3;
- YPos := Round(Reg4 * 1.6);
- IF XPos > 598 THEN BEGIN XPos := 598; XOld := 1; END;
- IF YPos > 309 THEN BEGIN YPos := 309; XOld := 1; END;
- IF XOld = 1 THEN BEGIN
- Reg1 := 4; Reg3 := XPos; Reg4 := YOld;
- HelpMouse(Reg1, Reg2, Reg3, Reg4);
- END;
- GetImage(XPos, YPos, XPos + 40, YPos + 40, Back^);
- PutImage(XPos, YPos, Stein[Stack[Reihe]]^, NormalPut);
- END;
- t := FALSE; a := '';
- IF KeyPressed THEN BEGIN
- ch := ReadKey;
- IF ch = Chr(0) THEN BEGIN
- ch := ReadKey;
- IF (ch = ';') THEN BEGIN
- IF NOT MenuFlag THEN Help ELSE Write(Chr(7));
- END;
- END;
- END;
- IF (Reg2 AND 1 = 1) THEN Taste := 1;
- IF (Reg2 AND 2 = 2) THEN Taste := 2;
- IF (Reg2 AND 3 = 3) THEN Taste := 3;
- UNTIL (Reg2 AND 1 = 1) OR (Reg2 AND 2 = 2);
- PutImage(XPos, YPos, Back^, NormalPut);
- END;
-
- (*--------------------------------------------------------*)
-
- PROCEDURE Titel; { zeichnet das Titelbild }
- BEGIN
- SetActivePage(0); ClearViewPort;
- SetFillStyle(SolidFill, Black);
- FloodFill(1, 1, Black);
- SetColor(LightBlue);
- Rectangle(0, 20, 639, 329);
- SetTextStyle(GothicFont, HorizDir, 5);
- x := TextWidth('Otashi');
- SetColor(White);
- OutTextXY(Round((640 - x) / 2), 20, 'Otashi');
- FOR y := 1 TO 5 DO BEGIN
- Str(y:1, a);
- OutTextXY( 15, y * 40 + 40, a);
- OutTextXY( 50, y * 40 + 40, Name[y]);
- OutTextXY(480, y * 40 + 40, Punkt[y]);
- END;
- SetTextStyle(TriplexFont, HorizDir, 2);
- x := TextWidth('Linke Maustaste = Spielbeginn');
- OutTextXY(Round((340 - x) / 2), 300,
- 'Linke Maustaste = Spielbeginn');
- x := TextWidth('Rechte Maustaste = DOS');
- OutTextXY(340 + Round((320 - x) / 2), 300,
- 'Rechte Maustaste = DOS');
- SetColor(LightBlue);
- Line(0, 70, 640, 70); Line(0, 72, 640, 72);
- Line(0, 290, 640, 290); Line(0, 292, 640, 292);
- FOR x := 1 TO 5 DO BEGIN
- PutImage(10 + (Pred(x)) * 50, 25,
- Stein[x + (Pred(x)) * 6]^, NormalPut);
- PutImage(637 - (x) * 50, 25,
- Stein[x + (Pred(x)) * 6]^, NormalPut);
- END;
- SetVisualPage(0);
- END;
-
- (*--------------------------------------------------------*)
-
- PROCEDURE SetzeStein(x, y, z: INTEGER);
- BEGIN
- PutImage(20 + (Pred(x)) * 40, 10 + (Pred(y)) * 40,
- Stein[z]^, NormalPut);
- Feld[x, y] := z;
- END;
-
- (*--------------------------------------------------------*)
-
- FUNCTION XPosition: INTEGER;
- BEGIN
- XPosition := Round((XPos - 20) / 40) + 1;
- END;
-
- (*--------------------------------------------------------*)
-
- FUNCTION YPosition: INTEGER;
- BEGIN
- YPosition := Round((YPos - 10) / 40) + 1;
- END;
-
- (*--------------------------------------------------------*)
-
- PROCEDURE SetzePunkte;
- BEGIN
- SetFillStyle(1, 0); Bar(502, 43, 580, 70);
- SetTextStyle(TriplexFont, HorizDir, 1);
- Str(Punkte: 6, a); OutTextXY(500, 40, a);
- END;
-
- (*--------------------------------------------------------*)
-
- PROCEDURE DecStack;
- BEGIN
- Bar(590, Reihe * 4, 630, Reihe * 4 + 4);
- Inc(Reihe);
- PutImage(590, Reihe * 4, Stein[Stack[Reihe]]^, NormalPut)
- END;
-
- (*--------------------------------------------------------*)
-
- PROCEDURE Check2;
- { Überprüft, welche Steine neben dem aktuellen liegen }
- VAR
- o, p: INTEGER;
- BEGIN
- q := 0; w := 0;
- o := Bilder[Stack[Reihe]]; p := Farben[Stack[Reihe]];
- IF (o = Bilder[Feld[Pred(s), t ]]) THEN Inc(q);
- IF (o = Bilder[Feld[Succ(s), t ]]) THEN Inc(q);
- IF (o = Bilder[Feld[ s , Pred(t)]]) THEN Inc(q);
- IF (o = Bilder[Feld[ s , Succ(t)]]) THEN Inc(q);
- IF (p = Farben[Feld[Pred(s), t ]]) THEN Inc(w);
- IF (p = Farben[Feld[Succ(s), t ]]) THEN Inc(w);
- IF (p = Farben[Feld[ s , Pred(t)]]) THEN Inc(w);
- IF (p = Farben[Feld[ s , Succ(t)]]) THEN Inc(w);
- END;
-
- (*--------------------------------------------------------*)
-
- PROCEDURE Single;
- BEGIN
- Check2;
- IF (q + w = 1) THEN BEGIN
- Inc(Punkte, 400);
- SetzeStein(s, t, z); DecStack; SetzePunkte;
- END;
- END;
-
- (*--------------------------------------------------------*)
-
- PROCEDURE Double;
- BEGIN
- Check2;
- IF (q = 1) AND (w = 1) THEN BEGIN
- Inc(Punkte, 800);
- SetzeStein(s, t, z); DecStack; SetzePunkte;
- END;
- END;
-
- (*--------------------------------------------------------*)
-
- PROCEDURE Triple;
- BEGIN
- Check2;
- IF ((q = 1) AND (w = 2)) OR
- ((q = 2) AND (w = 1)) THEN BEGIN
- Inc(Punkte, 2000);
- SetzeStein(s, t, z); DecStack; SetzePunkte;
- END;
- END;
-
- (*--------------------------------------------------------*)
-
- PROCEDURE Quadruple;
- BEGIN
- Check2;
- IF (q = 2) AND (w = 2) THEN BEGIN
- Inc(Punkte, 5000); SetzeStein(s, t, z);
- DecStack; SetzePunkte;
- END;
- END;
-
- (*--------------------------------------------------------*)
-
- PROCEDURE Check; { Hauptkontrollroutine }
- BEGIN
- n := 4;
- IF (Feld[Pred(s), t ] = 0) THEN Dec(n);
- IF (Feld[Succ(s), t ] = 0) THEN Dec(n);
- IF (Feld[ s , Pred(t)] = 0) THEN Dec(n);
- IF (Feld[ s , Succ(t)] = 0) THEN Dec(n);
- z := Stack[Reihe];
- IF (Feld[ s , Pred(t)] <> z) AND
- (Feld[ s , Succ(t)] <> z) AND
- (Feld[Pred(s), t ] <> z) AND
- (Feld[Succ(s), t ] <> z) THEN
- CASE n OF
- 0: BEGIN
- Inc(Punkte, 200); SetzePunkte;
- DecStack; SetzeStein(s, t, z);
- END;
- 1: Single;
- 2: Double;
- 3: Triple;
- 4: Quadruple;
- END;
- END;
-
- (*--------------------------------------------------------*)
-
- PROCEDURE Spiel; { Routine für das Spiel }
- VAR
- f1, f2 : INTEGER;
- BEGIN
- IF mode^ = HercMono THEN BEGIN
- f1 := 0; f2 := 0;
- END ELSE BEGIN
- f1 := 7; f2 := 8;
- END;
- Punkte := 0;
- FOR x := 0 TO 13 DO FOR y := 0 TO 9 DO Feld[x, y] := 0;
- SetActivePage(1);
- IF mode^ = HercMono THEN BEGIN
- OutTextXY(650, 314, 'Regeln:');
- OutTextXY(650, 329, 'F1-Taste');
- END;
- SetColor(LightBlue);
- Rectangle(0, 0, 639, 339); Rectangle(3, 2, 636, 337);
- FOR x := 1 TO 12 DO
- FOR y := 1 TO 8 DO BEGIN
- IF (x + y) MOD 2 = 0 THEN SetFillStyle(SolidFill, f1)
- ELSE SetFillStyle(SolidFill, f2);
- Bar((Pred(x)) * 40 + 20, (Pred(y)) * 40 + 10,
- (Pred(x)) * 40 + 60, (Pred(y)) * 40 + 50);
- Rectangle((Pred(x)) * 40 + 20, (Pred(y)) * 40 + 10,
- (Pred(x)) * 40 + 60, (Pred(y)) * 40 + 50);
- END;
- Line(584, 2, 584, 337); Line(582, 2, 582, 337);
- SetColor(White); SetTextStyle(TriplexFont, HorizDir, 2);
- OutTextXY(505, 20, 'Punkte');
- SetTextStyle(GothicFont, HorizDir, 4);
- SetColor(White);
- a := 'Otashi';
- FOR y := 1 TO 6 DO BEGIN
- x := TextWidth(a[y]);
- OutTextXY(Round(467 + y * 10 + (80 - x) / 2),
- 170 + y * 20, a[y]);
- END;
- SetzePunkte; SetVisualPage(1);
- FOR x := 72 DOWNTO 7 DO
- PutImage(590, x * 4, Stein[Stack[x]]^, NormalPut);
- Reihe := 7;
- FOR x := 1 TO 6 DO BEGIN
- SetzeStein(Pos1[x], Pos2[x], Stack[x]);
- Feld[Pos1[x], Pos2[x]] := Stack[x];
- END;
- REPEAT
- MouseCursor;
- IF (Taste = 1) THEN BEGIN
- s := XPosition; t := YPosition;
- IF (s IN [1..12]) AND
- (t IN [1.. 8]) AND (Feld[s, t] = 0) THEN Check;
- END;
- UNTIL (Taste = 2) OR (Reihe > 72);
- FOR x := 1 TO 5 DO Val(Punkt[x], tp[x], y);
- IF (Punkte >= tp[5]) THEN BEGIN
- Name[6] := '_______________';
- Str(Punkte: 6, Punkt[6]); SetFillStyle(1, 0);
- Bar(170, 150, 470, 200); SetColor(12);
- Rectangle(170, 150, 470, 200);
- Rectangle(173, 152, 467, 198);
- SetColor(15);
- SetTextStyle(DefaultFont, HorizDir, UserCharSize);
- OutTextXY(180, 160, Punkt[6]);
- IF mode^ = HercMono THEN x := 1 ELSE x := 2;
- SetTextStyle(DefaultFont, HorizDir, x);
- OutTextXY(180, 180, Name[6]);
- x := 1;
- REPEAT
- a := UpCase(ReadKey);
- IF a = 'ä' THEN a := 'Ä' ELSE
- IF a = 'ö' THEN a := 'Ö' ELSE
- IF a = 'ü' THEN a := 'Ü';
- IF (a[1] IN [#32..#126, 'Ä', 'Ö', 'Ü', 'ß']) AND
- (x < 16) THEN BEGIN
- Name[6, x] := a[1]; Inc(x);
- Bar(180, 180, 460, 196);
- OutTextXY(180, 180, Name[6]);
- END;
- IF (a = #8) AND (x > 1) THEN BEGIN
- Dec(x); Name[6, x] := '_';
- Bar(180, 180, 460, 196);
- OutTextXY(180, 180, Name[6]);
- END;
- WHILE KeyPressed DO a:= ReadKey;
- UNTIL (a = #27) OR (a = #13);
- FOR x := 1 TO 15 DO
- IF (Name[6, x] = '_') THEN Name[6, x] := #0;
- tp[6] := Punkte;
- FOR x := 1 TO 5 DO
- FOR y := x + 1 TO 6 DO
- IF (tp[y] > tp[x]) THEN BEGIN
- Punkte := tp[y]; tp[y] := tp[x]; tp[x] := Punkte;
- a := Name[x]; Name[x] := Name[y]; Name[y] := a;
- END;
- ReWrite(Safe);
- Write(Safe, FileHeader);
- FOR y := 1 TO 5 DO BEGIN
- Str(tp[y]: 6, b); Str(tp[y]: 6, Punkt[y]);
- a := b + Name[y];
- Write(Safe, a);
- END;
- Close(Safe);
- END;
- IF Reihe > 72 THEN Reihe := 72;
- Titel; Taste := 0; DoneFlag := FALSE;
- END;
-
- (*--------------------------------------------------------*)
-
- PROCEDURE MakeStack;
- VAR
- x, y: INTEGER;
- BEGIN
- HStack[-2] := 0; HStack[-1] := 0; HStack[0] := 0;
- Randomize;
- FOR x := 1 TO 36 DO HStack[x] := 2;
- y := Round(Random * 5) + 1;
- FOR x := 1 TO 6 DO BEGIN
- Dec(HStack[SStack[y]]); Stack[x] := SStack[y];
- Inc(y);
- IF y > 6 THEN y := 1;
- END;
- FOR x := 7 TO 72 DO BEGIN
- y := Round(Random * 35) + 1;
- IF (HStack[y] = 0) THEN REPEAT
- Inc(y, 3); IF (y > 36) THEN Dec(y, 37);
- UNTIL (HStack[y] <> 0);
- Stack[x] := y; Dec(HStack[y]); Taste := 0;
- END;
- END;
-
- (*--------------------------------------------------------*)
-
- PROCEDURE NeueScoreDatei;
- { Automatisches Anlegen einer neuen Highscore-Tabelle }
- BEGIN
- ReWrite(Safe);
- Write(Safe, FileHeader);
- a := ' 25000toolbox'#0#0#0#0#0#0#0#0; Write(Safe, a);
- a := ' 20000toolbox'#0#0#0#0#0#0#0#0; Write(Safe, a);
- a := ' 15000toolbox'#0#0#0#0#0#0#0#0; Write(Safe, a);
- a := ' 10000toolbox'#0#0#0#0#0#0#0#0; Write(Safe, a);
- a := ' 5000toolbox'#0#0#0#0#0#0#0#0; Write(Safe, a);
- Close(Safe);
- END;
-
- (*--------------------------------------------------------*)
-
- PROCEDURE GraphHalt;
- { Fehler bei der Initialisierung der Grafik }
- BEGIN
- Sound(880);
- TextColor(LightGray); WriteLn;
- WriteLn('Dieses Programm benötigt eine EGA-/VGA- ' +
- 'oder Hercules-Karte.');
- {$IFNDEF internaldrivers}
- WriteLn('Hinweis: Die Bildschirmtreiber "EGAVGA.BGI"' +
- ' und "HERCMONO.BGI"');
- WriteLn('müssen sich im aktuellen Verzeichnis befinden.');
- {$ENDIF}
- Delay(100);
- WriteLn; TextColor(White);
- Write('Otashi wird abgebrochen!');
- Sound(440);
- TextColor(LightGray); WriteLn; Delay(150);
- NoSound;
- Halt(1);
- END;
-
- (*--------------------------------------------------------*)
-
- BEGIN
- mode := Ptr($40, $49);
- CASE mode^ OF
- { Festlegen der Farben und Muster der Spielsteine }
- HercMono:
- BEGIN
- FOR i := 1 TO 6 DO Farbe[i] := 1;
- Fill[1] := SlashFill; Fill[2] := CloseDotFill;
- Fill[3] := LineFill; Fill[4] := BkSlashFill;
- Fill[5] := XHatchFill; Fill[6] := InterleaveFill;
- END;
- BW40, BW80:
- BEGIN
- Farbe[1] := LightBlue; Fill[1] := SlashFill;
- Farbe[2] := LightGreen; Fill[2] := CloseDotFill;
- Farbe[3] := Cyan; Fill[3] := SolidFill;
- Farbe[4] := LightRed; Fill[4] := BkSlashFill;
- Farbe[5] := LightMagenta; Fill[5] := XHatchFill;
- Farbe[6] := Yellow; Fill[6] := InterleaveFill;
- MonoMonitor := TRUE;
- END ELSE BEGIN
- {$IFDEF VER40}
- Farbe[1] := Blue; Farbe[2] := Green;
- Farbe[3] := Cyan; Farbe[4] := Red;
- Farbe[5] := Magenta; Farbe[6] := Yellow;
- {$ELSE}
- Farbe[1] := EGABlue; Farbe[2] := EGAGreen;
- Farbe[3] := EGACyan; Farbe[4] := EGARed;
- Farbe[5] := EGAMagenta; Farbe[6] := EGAYellow;
- {$ENDIF}
- FOR i := 1 TO 6 DO Fill[i] := SolidFill;
- MonoMonitor := FALSE;
- END;
- END;
- { Programmnamen für die Scoretabelle aus dem PSP holen: }
- {$IFDEF VER40}
- ScoreFile := 'OTASHI.SCR';
- {$ELSE}
- ScoreFile := ParamStr(0);
- FSplit(ScoreFile, ScoreFileDir, ScoreFileName,
- ScoreFileExt);
- ScoreFile := Concat(ScoreFileDir,
- ScoreFileName,
- '.SCR');
- {$ENDIF}
- IF ScoreFile = '' THEN ScoreFile := 'OTASHI.SCR';
- Assign(Safe, ScoreFile);
- MakeStack; Reihe := 1; Reg1 := 0;
- HelpMouse(Reg1, Reg2, Reg3, Reg4);
- IF Reg1 = -1 THEN BEGIN
- x := 0; y := 0;
- {$IFNDEF VER40}
- FindFirst(ScoreFile, AnyFile, sr);
- IF DosError = 18 THEN NeueScoreDatei;
- Reset(Safe);
- {$ELSE}
- Reset(Safe);
- IF IoResult <> 0 THEN BEGIN
- NeueScoreDatei;
- Reset(Safe);
- END;
- {$ENDIF}
- Seek(Safe, 1);
- REPEAT
- { Länge der Scoretabelle ist fehlerhaft --> nochmal: }
- IF Eof(Safe) THEN BEGIN
- Close(Safe); NeueScoreDatei;
- Reset(Safe); Seek(Safe, 1);
- y := 0;
- END;
- INC(y);
- Read(Safe, a);
- Punkt[y] := Copy(a, 1, 6);
- Name[y] := Copy(a, 7, 15);
- UNTIL y > 4;
- DetectGraph(GraphDriver, GraphMode);
- IF mode^ = HercMono THEN BEGIN
- GraphDriver := mode^;
- GraphMode := HercMonoHi;
- END ELSE BEGIN
- IF NOT (GraphDriver IN [EGA, VGA]) THEN GraphHalt;
- GraphDriver := EGA;
- GraphMode := EGAHi;
- END;
- {$IFDEF internaldrivers}
- i := RegisterBGIDriver(@EGAVGADriverProc);
- j := RegisterBGIDriver(@HercDriverProc);
- IF (i < 0) OR (j < 0) THEN BEGIN
- TextColor(LightGray);
- WriteLn('Fehler bei der Installation der Grafik.');
- TextColor(White); WriteLn('Otashi wird abgebrochen.');
- TextColor(LightGray); Halt(2);
- END;
- {$ENDIF}
- {$IFDEF internalfonts}
- {$IFDEF VER60}
- RegisterBGIFont(@TriplexFontProc);
- RegisterBGIFont(@GothicFontProc);
- {$ELSE}
- i := RegisterBGIFont(@TriplexFontProc);
- i := RegisterBGIFont(@GothicFontProc);
- {$ENDIF}
- {$ENDIF}
- InitGraph(GraphDriver, GraphMode, GetEnv('BGIPATH'));
- IF GraphResult < 0 THEN GraphHalt;
- SetColor(LightBlue);
- Rectangle(0, 20, GetMaxX - 1, GetMaxY - 20);
- SetTextJustify(CenterText, CenterText);
- SetColor(Yellow);
- SetTextStyle(GothicFont, HorizDir, 7);
- OutTextXY(GetMaxX DIV 2, GetMaxY DIV 2 - 110,
- 'O t a s h i');
- SetTextStyle(TriplexFont, HorizDir, 2);
- OutTextXY(GetMaxX - 75, GetMaxY DIV 2 - 100, version);
- SetTextStyle(GothicFont, HorizDir, 5);
- OutTextXY(GetMaxX DIV 2, GetMaxY DIV 2,
- '(c) 1991 V. Stegmann & toolbox');
- SetColor(LightRed);
- SetTextStyle(TriplexFont, HorizDir, 3);
- OutTextXY(GetMaxX DIV 2, GetMaxY DIV 2 + 80,
- 'Spielsteine werden aufgebaut');
- OutTextXY(GetMaxX DIV 2, GetMaxY DIV 2 + 110,
- 'Bitte warten . . .');
- SetTextJustify(LeftText, TopText);
- SteinGrafiken; MenuFlag := TRUE; Titel;
- REPEAT
- MouseCursor;
- IF (Reg2 AND 1 = 1) THEN BEGIN
- Punkte := 0; Size := ImageSize(0, 300, 50, 300);
- GetMem(Back2, Size);
- GetImage(170, 150, 470, 200, Back2^);
- SetFillStyle(SolidFill, Black);
- Bar(170, 150, 470, 200);
- SetColor(LightRed); Rectangle(170, 150, 470, 200);
- Rectangle(173, 152, 467, 198); SetColor(White);
- SetTextStyle(DefaultFont, HorizDir, UserCharSize);
- OutTextXY(180, 160,
- 'Wollen Sie die Steine neu mischen ?');
- OutTextXY(220, 175, 'Linke Maustaste = Ja');
- OutTextXY(220, 187, 'Rechte Maustaste = Nein');
- Delay(350); MouseCursor; Delay(350);
- IF Taste = 1 THEN MakeStack; Taste := 0;
- PutImage(170, 150, Back2^, NormalPut);
- MenuFlag := FALSE; Spiel; MenuFlag := TRUE;
- END;
- UNTIL Taste = 2;
- CloseGraph; TextMode(LastMode);
- END ELSE BEGIN
- Write('Maustreiber fehlt !'); TextColor(White);
- Write('Otashi wird abgebrochen.');
- TextColor(LightGray); WriteLn;
- END;
- END.
-
- (*========================================================*)
- (* Ende von Otashi.Pas *)
-