PROGRAM CD_Install;

{$M $8192,0,0 }   { 16K stack, no heap }

USES rahmen, crt , dos, win;

  TYPE string8  = string[8];
       string28 = string[28];

  CONST

    req        = 4096;
    zeichen    = #177;
    Backspace = #08;
    ESC = #27;
    CRight  = ^D;
    CUp     = ^E;
    CEnter  = ^M;
    CLeft   = ^S;
    CDown   = ^X;
    CExit   = ^[;

  VAR

    schriftzug          : array[1..5] of string[66];
    unzip               : string[10];
    i, j                : integer;
    g1, g2, zaehlt_mit  : integer;
    taste,ch            : char;
    pfad                : dirstr;
    instlfwk, ziellfwk  : string[2];
    setting             : string[79];
    parameters          : string;
    hdwert              : byte;
    hdfrei,  more       : longint;
    origmode            : word;
    fertig, done        : boolean;
    art : string[3];

procedure auswahl1;forward;
procedure Beep;
begin
{  Sound(400); Delay(200); NoSound;}
end;

procedure install(path : dirstr);
begin
    window(1,1,80,25);
    textbackground(black);
    textcolor(white);
    clrscr;
    mkdir(path);
    UNZIP := 'unpack.exe';
    parameters := 'x -y -va '+instlfwk + '\data.00? '+  path;
    swapvectors;
    exec (unzip,parameters);
    swapvectors;
    textcolor(red);
    case doserror of 0 :
    begin
      sound(100);delay(700);nosound;
      sound(200);delay(700);nosound;
      sound(300);delay(700);nosound;
      writeln('Installation erfolgreich abgeschlossen !');
    end;
    8 : begin pfad := '';writeln('Nicht gengend Speicher vorhanden !');end;
    else
      begin
        pfad := '';
        writeln('Installation abgebrochen !');
      end;
    end;
    taste := readkey;
auswahl1;
end; {procedure INSTALL}

Function Readcharr : Char;
Var laenge : integer ;
    ch     : char;
Begin
  Ch := ReadKey;
  if Ch = #0 then
    case ReadKey of
      #45: Ch := CExit;     { Alt-X }
      #72: Ch := CUp;       { Up }
      #75: Ch := CLeft;     { Left  }
      #77: Ch := CRight;    { Right}
      #80: Ch := CDown;     { Down }
    end;
  ReadCharr := Ch;
  case Ch of center     : Begin
                            fertig := true;
                          end;
             esc       :   auswahl1;
             backspace :   begin
                             laenge := length(pfad);
                             delete (pfad,laenge,1);
                           end;
             cdown       : pfad := pfad;
             cup         : pfad := pfad;
             cright      : pfad := pfad;
             cleft       : begin
                           laenge := length(pfad);
                           delete (pfad,laenge,1);
                         end;

  else pfad := pfad + ch;
  end;
end;
procedure error;forward;

procedure test_var;
var p2 ,p3 : dirstr;
begin
  if zaehlt_mit / 2 = int(zaehlt_mit / 2) then
    begin
      p2 := pfad;
      if (p2[2] <> ':') or (p2[3] <> '\') then error;
      p3 := '';
    end;
  if zaehlt_mit / 2 <> int(zaehlt_mit / 2) then
    begin
      p3 := pfad;
      if (p3[2] <> ':') or (p3[3] <> '\') then error;
      p2 := '';
    end;
end;

procedure change_path;
begin
  gotoxy(2,5);textbackground(red);write('                                           ');
  gotoxy(2,5);textcolor(white);
  write (pfad);
  fertig := false;
  repeat
    taste := readcharr;
    gotoxy (2,5); write('                                           ');
    gotoxy (2,5); write(pfad);
  until fertig = true;
test_var;
end;

procedure error ;
  begin
    textcolor(black);textbackground(lightgray);
    clrscr;
    rahme_doppelt(1,1,45,8);
    sound(410);delay(1700);NoSound;
    textcolor(red + blink);
    gotoxy(2,2);write('Falscher Pfadname !');
    textcolor(black);
    gotoxy(2,3);write('Syntax: Laufwerk\Pfadname');
    gotoxy(2,4);write('z.B.: C:\OMF');
    change_path;
    textcolor(black);textbackground(lightgray);
  end;

procedure input;
BEGIN
  pfad := 'C:\OMF';
  window(18,9,63,16);
  textbackground(lightgray);
  textcolor(black);
  clrscr;
  rahme_doppelt(1,1,45,8);
  gotoxy(2,2);write('In welches Verzeichnis willst du  ');
  gotoxy(2,3);write('One must Fall 2097 installieren ? ');
  gotoxy(2,7);write('Drcke <ESC> um abzubrechen.');
  change_path;
  textcolor(black);textbackground(lightgray);
  ziellfwk := pfad;
  chdir(ziellfwk);
  hdfrei := diskfree(0) div 1024;
    chdir(instlfwk);
    if req >= hdfrei then
    begin
      more := req - hdfrei;
      gotoxy(2,6);write('Zuwenig Speicherplatz auf Laufwerk ',ziellfwk);
      gotoxy(2,7);write('Du bentigst min. ',more,' KB mehr.');
      inc (zaehlt_mit);
      taste := readkey;
      auswahl1;
    end;
    if req < hdfrei then
    begin
      for i := 1 to Length(pfad) do
        pfad[i] := UpCase(pfad[i]);
      install(pfad);
      auswahl1;
    end;
end;

procedure escape;
begin
   window(1,1,80,25);
   textcolor(lightgray);textbackground(black);
   clrscr;
   writeln('Tsch !');
   halt(1);
end;

function ReadChar: Char;
var
  Ch: Char;
begin
  Ch := ReadKey;
  if Ch = #0 then
    case ReadKey of
      #45: Ch := CExit;     { Alt-X }
      #72: Ch := CUp;       { Up }
               {      #75: Ch := CLeft;      Left }
               {      #77: Ch := CRight;     Right }
      #80: Ch := CDown;     { Down }
    end;
  ReadChar := Ch;
end;
procedure setup;
begin
  if Pfad = '' then
    begin
      textbackground(lightgray);textcolor(black);
      clrscr;
      rahme_ein(1,1,34,8);
      gotoxy(2,2);
      write ('Du mut zuerst das Spiel');
      gotoxy(2,3);write('installieren !');
      taste := readkey;
    end;
  if pfad <> '' then
  begin
    chdir(pfad);
    swapvectors;
    exec('Setup.exe','');
    swapvectors;
    chdir(instlfwk);
  end;
auswahl1;
end;

procedure txt;
begin
  textbackground(lightgray);textcolor(black);
  clrscr;
  gotoxy(2,2);write('Die Combos von Shadow kannst du ');
  gotoxy(2,3);writeln('von mir (Retnyg) kopieren, alle ');
  gotoxy(2,4);writeln('anderen Moves und Combos findest');
  gotoxy(2,5);writeln('du in der Datei "OMF.TXT".');
  gotoxy(2,6);writeln('');
  gotoxy(2,7);writeln('');
  gotoxy(2,8);write('');
taste := readkey;
auswahl1;
end;


procedure auswahl1;
var auswl : array [1..4] of String[28];
label hoch;
BEGIN
  TextAttr := black + lightgray * 16;
  Window(1, 2, 80, 24);
  FillWin(zeichen, darkgray + blue * 16);
  Window(1, 1, 80, 25);
  write('            U M P    O N K E Y    O F T W A R E  P R E S E N T S :        ');
  textcolor(red);
  gotoxy(11, 1);write('D');gotoxy(20,1);write('M');gotoxy(33,1);write('S');
  gotoxy(70,1);
  ClrEol;
  GotoXY(1, 1);
  GotoXY(1, 25);clreol;
  gotoxy(18,25);
  Write('<ESC> : ABBRUCH ;  1, 2, oder 3 : WEITERMACHEN');
  ClrEol;
  TextAttr := darkgray + blue * 16;
  schriftzug[1] := ('                        ') ;
  schriftzug[2] := ('                                           ') ;
  schriftzug[3] := ('                                     ') ;
  schriftzug[4] := ('                                              ') ;
  schriftzug[5] := ('                               ') ;
  for g2 := 1 to 5 do
  begin
    while Pos(' ', schriftzug[g2]) > 0 do
    schriftzug[g2,Pos(' ', schriftzug[g2])] := zeichen;
  end;
  for g1 := 1 to 4 do begin gotoxy (8,3 + g1);writeln (Schriftzug[g1]);end;
  gotoxy(8,8);
  write (schriftzug[5]);
  textcolor(lightblue);
  window(20,11,60,13);
  textbackground(blue);
  clrscr;
  rahme_ein(1,1,40,3);
  gotoxy(2,2);
  textcolor(yellow);
  write('  Installationsprogramm fr OMF 2097');
  window(1,1,80,25);

  window(23,15,57,22);
  textbackground(white);
  textcolor(black);
  clrscr;
  rahme_ein(1,1,34,8);
  textcolor(blue);
  auswl[1] := '1. INSTALLIEREN            ';
  auswl[2] := '2. SOUNDKARTE KONFIGURIEREN';
  auswl[3] := '3. WICHTIGE INSTRUKTIONEN  ';
  auswl[4] := '4. AUSSTEIGEN (ESC)        ';
  gotoxy (2,2);textcolor(white);textbackground(red);write(auswl[1]);
  textcolor(blue);textbackground(lightgray);
  for g1 := 2 to 4 do
  begin
    gotoxy(2,g1+1);
    write(auswl[g1]);
  end;
  gotoxy (2,7);write('Drcke 1,2,3,',#25,',',#24,', Enter oder ESC');
  gotoxy (2,2);
  hoch:
  ch := readchar;
  case ch of
    '1' : input;
    '2' : setup;
    '3' : txt;
    '4' : escape;
    cup : begin
             if wherey = 2 then begin beep; goto hoch; end;
             gotoxy(2,wherey);
             textbackground(lightgray);textcolor(blue);
             write(auswl[wherey - 1]);
             GotoXY(2, WhereY - 1);
             textbackground(red);textcolor(white);
             write(auswl[wherey - 1]);
             gotoxy(2,wherey);
             goto hoch;
            end;
    cdown : begin
                 if wherey = 5 then begin beep; goto hoch; end;
                 gotoxy(2,wherey);
                 textbackground(lightgray);textcolor(blue);
                 write(auswl[wherey - 1]);
                 GotoXY(2, WhereY + 1);
                 textbackground(red);textcolor(white);
                 write(auswl[wherey - 1]);
                 gotoxy(2,wherey);
                 goto hoch;
               end;
    center: begin
              if wherey = 2 then input;
              if wherey = 3 then setup;
              if wherey = 4 then txt;
              if wherey = 5 then escape;
            end;
    cexit : escape;
    esc : escape;
  else goto hoch;
  end;
end;


BEGIN
  pfad := '';
  zaehlt_mit := 1;
  art := ' ';
  getdir(0,instlfwk);
  taste := #0;
  auswahl1;
END.
fillchar
move
eof
eol
sizeof
OMF
{color   Klicke hierdrauf, um die Farbwerte zu erfahren.}