home *** CD-ROM | disk | FTP | other *** search
/ Aminet 6 / Aminet 6 - June 1995.iso / Aminet / util / blank / bserver_v14.lha / BServer_v1.4 / Sources.lha / Sources / clients / ScreenFall.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-03-23  |  2.3 KB  |  115 lines

  1. ;/*
  2. sc RESOPT IGNORE=73 DATA=NEAR NMINC UCHAR CONSTLIB STREQ STRMERGE NOSTKCHK NOSTDIO OPTIMIZE OPTSIZE ScreenFall.c
  3. slink from LIB:c.o ScreenFall.o to //Clients/ScreenFall LIB LIB:sc.lib LIB:amiga.lib /lib/client.lib SC SD STRIPDEBUG NOICONS
  4. delete ScreenFall.o
  5. quit
  6.  
  7.  ScreenFall 1.0  (Client for BServer)
  8.  
  9.  Copyright © 1995 Stefano Reksten of 3AM - The Three Amigos!!!
  10.  All rights reserved.
  11. */
  12.  
  13. #include <exec/types.h>
  14. #include <exec/memory.h>
  15. #include <intuition/intuitionbase.h>
  16.  
  17. #include <proto/exec.h>
  18. #include <proto/intuition.h>
  19. #include <proto/graphics.h>
  20.  
  21. #include "/include/client.h"
  22.  
  23. char *ver = "$VER: ScreenFall 1.2 "__AMIGADATE__;
  24.  
  25. struct IntuitionBase *IntuitionBase;
  26. struct GfxBase *GfxBase;
  27. struct DisplayIDInformation *dinfo;
  28.  
  29. void ScreenFall( void )
  30. {
  31. struct Screen *blackscr, *scr, *tmpscr;
  32. UWORD scrtop, scrfall;
  33. UBYTE gravity;
  34. BOOL StillBlanking = TRUE, StillDropping = TRUE;
  35.  
  36. if ( blackscr = OpenScreenTags( NULL,
  37.     SA_Depth, 0,
  38.     SA_Behind, TRUE,
  39.     SA_DisplayID, DISPLAYID( dinfo ),
  40.     TAG_END ) )
  41.     {
  42.     register struct ViewPort *vp = &(blackscr->ViewPort);
  43.  
  44.     SetRGB4( vp, 0, 0, 0, 0 );
  45.  
  46.     scr = IntuitionBase->FirstScreen;
  47.     scrtop = scr->TopEdge;
  48.     scrfall = 0;
  49.     gravity = 1;
  50.  
  51.     while( StillDropping && StillBlanking )
  52.         {
  53.         StillBlanking = ( GetServerCommand() == COMMAND_IDLE );
  54.  
  55.         if ( scrtop + scrfall <= scr->Height )
  56.             {
  57.             MoveScreen( scr, 0, gravity );
  58.             scrfall += gravity;
  59.             gravity++;
  60.             }
  61.         else
  62.             {
  63.             tmpscr = scr->NextScreen;
  64.             ScreenToBack( scr );
  65.             MoveScreen( scr, 0, - scrfall );
  66.             scr = tmpscr;
  67.             scrtop = scr->TopEdge;
  68.             scrfall = 0;
  69.             gravity = 1;
  70.             if ( scr == blackscr )
  71.                 StillDropping = FALSE;
  72.             }
  73.         }
  74.  
  75.     if ( StillBlanking )
  76.         {
  77.         SpritesOff();
  78.         WaitServerCommand();
  79.         SpritesOn();
  80.         }
  81.     else
  82.         {
  83.         ScreenToBack( scr );
  84.         MoveScreen( scr, 0, - scrfall );
  85.         while ( scr != blackscr )
  86.             {
  87.             scr = IntuitionBase->FirstScreen;
  88.             ScreenToBack( scr );
  89.             }
  90.         }
  91.  
  92.     CloseScreen( blackscr );
  93.     }
  94. else
  95.     SendClientMsg( ACTION_FAILED );
  96. }
  97.  
  98.  
  99. void __main( char *line )
  100. {
  101. if ( IntuitionBase = (struct IntuitionBase *)OpenLibrary( "intuition.library", 37L ) )
  102.     {
  103.     if ( GfxBase = (struct GfxBase *)OpenLibrary( "graphics.library", 37L ) )
  104.         {
  105.         if ( dinfo = OpenCommunication() )
  106.             {
  107.             ScreenFall();
  108.             CloseCommunication( dinfo );
  109.             }
  110.         CloseLibrary( (struct Library *)GfxBase );
  111.         }
  112.     CloseLibrary( (struct Library *)IntuitionBase );
  113.     }
  114. }
  115.