home *** CD-ROM | disk | FTP | other *** search
/ Fresh Fish 9 / FreshFishVol9-CD2.bin / bbs / util / gblanker-38.8.lha / GBlanker / GSource / Blankers / Fade / blank.c next >
C/C++ Source or Header  |  1994-12-22  |  1KB  |  68 lines

  1. /*
  2.  *  Copyright (c) 1994 Michael D. Bayne.
  3.  *  All rights reserved.
  4.  *
  5.  *  Please see the documentation accompanying the distribution for distribution
  6.  *  and disclaimer information.
  7.  */
  8.  
  9. #include <exec/memory.h>
  10. #include "/includes.h"
  11.  
  12. #define DELAY   0
  13. #define PERCENT 2
  14. #define TOPSCR  4
  15.  
  16. #include "Fade_rev.h"
  17. STATIC const UBYTE VersTag[] = VERSTAG;
  18.  
  19. VOID Defaults( PrefObject *Prefs )
  20. {
  21.     Prefs[DELAY].po_Level = 15;
  22.     Prefs[PERCENT].po_Level = 75;
  23.     Prefs[TOPSCR].po_Active = 0;
  24. }
  25.  
  26. LONG Blank( PrefObject *Prefs )
  27. {
  28.     struct Screen *FScr;
  29.     LONG RetVal = OK;
  30.     
  31.     if( FScr = cloneTopScreen( FALSE, Prefs[TOPSCR].po_Active ))
  32.     {
  33.         LONG ToFrontCount = 0, PctCount, BPG;
  34.         LONG Delay = Prefs[DELAY].po_Level + 1;
  35.         struct Window *Wnd;
  36.         ULONG *ColorTable;
  37.         
  38.         Wnd = BlankMousePointer( FScr );
  39.         ColorTable = GetColorTable( FScr );
  40.         
  41.         BPG = AvgBitsPerGun( getTopScreenMode());
  42.         PctCount = ( 1L << BPG ) * Prefs[PERCENT].po_Level / 100;
  43.         
  44.         do
  45.         {
  46.             ToFrontCount++;
  47.             WaitTOF();
  48.             
  49.             if( !( ToFrontCount%Delay ) && ( ToFrontCount/Delay ) < PctCount )
  50.                 FadeAndLoadTable( FScr, BPG, ColorTable, 0 );
  51.             
  52.             if(!( ToFrontCount % 60 ))
  53.                 ScreenToFront( FScr );
  54.             
  55.             if(!( ToFrontCount % 5 ))
  56.                 RetVal = ContinueBlanking();
  57.         }
  58.         while( RetVal == OK );
  59.         
  60.         UnblankMousePointer( Wnd );
  61.         CloseScreen( FScr );
  62.     }
  63.     else
  64.         RetVal = FAILED;
  65.  
  66.     return RetVal;
  67. }
  68.