home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 5 / 05.iso / a / a067 / 1.img / GRUMP501.EXE / FADEIN.PRG < prev    next >
Encoding:
Text File  |  1991-04-23  |  1.6 KB  |  50 lines

  1. /*
  2.     Function: FadeIn()
  3.     System:   GRUMPFISH LIBRARY
  4.     Author:   Greg Lief
  5.     Copyright (c) 1988-90, Greg Lief
  6.     Clipper 5.x Version
  7.     Compile instructions: clipper fadein /n/w/a
  8.  
  9.     Syntax: FadeIn(<filename>)
  10.  
  11.     Parameter: <filename> is a character string representing the name
  12.                of file in which the screen was saved with Sv_FadeIn().
  13.  
  14.     Returns: A logical value: .T. if successful, .F. if unsuccessful
  15.              (the only way I can see it failing is if there are not
  16.              enough available file handles to open the screen file)
  17. */
  18.  
  19. //───── begin preprocessor directives
  20.  
  21. #include "fileio.ch"
  22.  
  23. //───── end preprocessor directives
  24.  
  25. function fadein(cfile)
  26. local nhandle := fopen(cfile, FO_READ), nrow, ncol, buffer := space(2), ;
  27.       xx, ret_val := .f., filesize := (maxrow() + 1) * (maxcol() + 1)
  28. if nhandle > -1
  29.    //───── verify that this file was saved in the same mode that we are in
  30.    //───── because if it wasn't, all hell will break loose further down
  31.    if fseek(nhandle, 0, FS_END) == filesize * 4
  32.       fseek(nhandle, 0, FS_SET)       // reset to start of file
  33.       ret_val := .t.
  34.       nrow := ncol := space(1)
  35.       for xx = 1 to filesize
  36.          fread(nhandle, @nrow, 1)
  37.          fread(nhandle, @ncol, 1)
  38.          fread(nhandle, @buffer, 2)
  39.          restscreen(bin2i(nrow), bin2i(ncol), bin2i(nrow), bin2i(ncol), buffer)
  40.       next
  41.    endif
  42. endif
  43. fclose(nhandle)
  44. return ret_val
  45.  
  46. * end function FadeIn()
  47. *--------------------------------------------------------------------*
  48.  
  49. * eof fadein.prg
  50.