home *** CD-ROM | disk | FTP | other *** search
/ PC Underground / UNDERGROUND.ISO / graphic / fade_in.pas < prev    next >
Pascal/Delphi Source File  |  1995-07-28  |  1KB  |  30 lines

  1. uses crt,ModeXLib,Tools;
  2. var i,j:word;
  3.     destpal:Array[0..767] of Byte;
  4.  
  5. Procedure Fade_in(DPal:Array of Byte);
  6. Begin
  7.   For j:=0 to 63 do Begin       {64 passes, in order to fade completely}
  8.     For i:=0 to 767 do          {calculate 768 color values}
  9.       If Palette[i] < DPal[i]   {current value still smaller that destination value ?}
  10.         Then Inc(Palette[i]);   {then increase}
  11.     WaitRetrace;                {synchronization}
  12.     SetPal;                     {set calculated palette}
  13.   End;
  14. End;
  15.  
  16. begin
  17.   ClrScr;                       {clear screen}
  18.   GetPal;                       {load "Palette" with current DAC-palette}
  19.   Move(Palette,Destpal,768);    {save palette}
  20.   FillChar(Palette,768,0);      {delete old palette}
  21.   SetPal;                       {and set}
  22.  
  23.   Draw_Ansi('color.ans');       {load wallpaper}
  24.  
  25.   ReadLn;
  26.   fade_in(Destpal);             {fade to destination pal (original palette)}
  27.   ReadLn;
  28.   TextMode(3);                  {establish normal state}
  29. End.
  30.