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

  1. /*
  2.      Program: HBLINDS.PRG
  3.      System: GRUMPFISH LIBRARY
  4.      Author: Greg Lief
  5.      Copyright (c) 1988-90, Greg Lief
  6.      Clipper 5.x version
  7.      Compile instructions: clipper hblinds /n/w/a
  8.  
  9.      Procs & Fncts: HBLINDOPEN()
  10.                   : HBLINDCLOS()
  11.                   : HBLINDSAVE()
  12.  
  13.      NOTE: These three functions support 25 and 50 line display only!
  14. */
  15.  
  16. //───── begin preprocessor directives
  17.  
  18. #include "grump.ch"
  19. #include "fileio.ch"
  20.  
  21. //───── end preprocessor directives
  22.  
  23. /*
  24.     Function: HBLINDOPEN()
  25.     Purpose:  Draw title screen using horizontal blinds effect
  26.     NOTE:     Title screen must be pre-saved using HBLINDSAVE()
  27.     Syntax:   Hblindopen(<name of screen file>, [<delay>])
  28.               Default delay is 15 - change it to suit your hardware
  29. */
  30. function hblindopen(cfile, ndelay)
  31. local nhandle, screen_[maxrow() + 1], nbufferlen := (maxcol() + 1) * 2, ;
  32.       maxrow := maxrow() + 1, maxcol := maxcol() + 1, xx, yy, buffer
  33. default ndelay to 15
  34. //───── sorry -- cannot currently accommodate 43-line mode (25 or 50 only)
  35. //───── this is because 43 happens to be a prime number, and thus causes
  36. //───── problems when we attempt to evenly divide the display intervals
  37. if maxrow != 43
  38.    if file(cfile)
  39.       buffer := space(nbufferlen)
  40.       nhandle = fopen(cfile, FO_READ)
  41.       //───── verify that this file was saved in the same mode that we are in
  42.       //───── because if it wasn't, all hell will break loose further down
  43.       if fseek(nhandle, 0, FS_END) == maxrow * maxcol * 2
  44.          fseek(nhandle, 0, FS_SET)       && reset to start of file
  45.          for xx = 1 to maxrow
  46.             fread(nhandle, @buffer, 160)
  47.             screen_[xx] := buffer
  48.          next
  49.          fclose(nhandle)
  50.          for xx = 4 to 0 step -1
  51.             for yy = (maxrow / 6.25) to 0 step -1
  52.                restscreen(yy*5 + xx, 0, yy*5 + xx, maxcol-1, screen_[yy*5+xx+1])
  53.             next
  54.             for yy = 1 to ndelay
  55.             next
  56.          next
  57.       endif
  58.    endif
  59. endif
  60. return NIL
  61.  
  62. * end function HBlindOpen()
  63. *--------------------------------------------------------------------*
  64.  
  65. /*
  66.     Function: HBLINDCLOS()
  67.     Purpose:  Clear screen using horizontal blinds effect
  68.     Syntax:   Hblindclos([<delay>])
  69.               Default delay is 30 - change it to suit your hardware
  70. */
  71. function hblindclos(ndelay)
  72. local xx, yy, maxrow := maxrow() + 1, maxcol := maxcol()
  73. default ndelay to 30
  74. for xx = 0 to 4
  75.    for yy = 0 to maxrow / 6.25
  76.       scroll(yy * 5 + xx, 0, yy * 5 + xx, maxcol, 0)
  77.    next
  78.    for yy = 1 to ndelay
  79.    next
  80. next
  81. return NIL
  82.  
  83. * end function HBlindClos()
  84. *--------------------------------------------------------------------*
  85.  
  86.  
  87. /*
  88.     Function: HBLINDSAVE()
  89.     Purpose:  Save title screen to specified memory file
  90.     Syntax:   HBlindSave(<name of screen file>)
  91. */
  92. function hblindsave(cfile)
  93. local buffer, handle := fcreate(cfile, FC_NORMAL), xx, ret_val := .f., ;
  94.       maxrow := maxrow(), maxcol := maxcol()
  95. if ferror() = 0
  96.    ret_val := .t.
  97.    for xx = 0 to maxrow
  98.       buffer := savescreen(xx, 0, xx, maxcol)
  99.       if fwrite(handle, buffer) != (maxcol + 1) * 2
  100.          ret_val := .f.
  101.          exit
  102.       endif
  103.    next
  104.    fclose(handle)
  105. endif
  106. return ret_val
  107.  
  108. * end function HBlindSave()
  109. *--------------------------------------------------------------------*
  110.  
  111. * eof hblinds.prg
  112.