home *** CD-ROM | disk | FTP | other *** search
/ Simtel MSDOS - Coast to Coast / simteldosarchivecoasttocoast2.iso / c / pcw_c.zip / WEXPLODE.C < prev    next >
C/C++ Source or Header  |  1991-10-27  |  3KB  |  81 lines

  1. /***********************************************************/
  2. /* File Id.                  Wexplode.C                    */
  3. /* Author.                   Stan Milam.                   */
  4. /* Date Written.             11/13/88.                     */
  5. /*                                                         */
  6. /*          (c) Copyright 1989-90 by Stan Milam            */
  7. /*                                                         */
  8. /* Comments: This module will save (wpush), color(wfill),  */
  9. /* frame (wbox) with the current border type & color, a    */
  10. /* single window.                                          */
  11. /*                                                         */
  12. /* Modifications: 10/06/89: Made major modifications to    */
  13. /* speed up the process of exploding the window on CGA     */
  14. /* monitors.  We expand the window 4 rows & cols when      */
  15. /* possible.                                               */
  16. /***********************************************************/
  17.  
  18. #include <stdio.h>
  19. #include <dos.h>
  20. #include "pcw.i"
  21. #include "pcwproto.h"
  22. extern int CheckSnow;
  23.  
  24.  
  25. WNDPTR *wexplode(int ur,int uc,int lr,int lc,int fclr,int bclr) {
  26.  
  27.      WNDPTR *temp;
  28.      int    r1,c1,r2,c2;
  29.      int    rows, cols, attr;
  30.      int    page, pagesize;
  31.      int    far *scrnptr;
  32.      unsigned offset,scrnseg;
  33.  
  34.      if ((temp = wpush(ur,uc,lr,lc)) == (WNDPTR *) NULL)
  35.         return (NULL);
  36.  
  37.      scrnseg = getscrnseg();
  38.      page    = getpage();
  39.      pagesize= getpagesize();
  40.      attr    = MK_ATTR(fclr,bclr) | 32;
  41.  
  42.      c1 = ((temp->ucol + temp->lcol) / 2) - 1;
  43.      c2 = ((temp->ucol + temp->lcol) / 2) + 1;
  44.      r1 = ((temp->urow + temp->lrow) / 2) - 1;
  45.      r2 = ((temp->urow + temp->lrow) / 2) + 1;
  46.      rows = (r2 - r1) + 1;
  47.      cols = (c2 - c1) + 1;
  48.      offset = MK_SCRNOFF(r1, c1);
  49.      scrnptr= (int far *)MK_FP(scrnseg,offset);
  50.      TextFill(rows, cols, scrnptr, attr);
  51.      while (((c1 != temp->ucol) || (r1 != temp->urow)) ||
  52.      ((c2 != temp->lcol) || (r2 != temp->lrow))) {
  53.         if (_adaptor == CGA) {
  54.            if (c1 != uc)
  55.               if (uc <= (c1 - 2)) c1 -= 2; else c1--;
  56.            if (c2 != lc)
  57.                if (lc >= (c2 + 2)) c2 += 2; else c2++;
  58.            if (r1 != ur)
  59.               if (ur <= (r1 - 2)) r1 -= 2; else r1--;
  60.            if (r2 != lr)
  61.               if (lr >= (r2 + 2)) r2 += 2; else r2++;
  62.         }
  63.         else {
  64.            if (c1 != uc) c1--;
  65.            if (c2 != lc) c2++;
  66.            if (r1 != ur) r1--;
  67.            if (r2 != lr) r2++;
  68.            _delay(5);
  69.         }
  70.         rows = (r2 - r1) + 1;
  71.         cols = (c2 - c1) + 1;
  72.         offset = MK_SCRNOFF(r1, c1);
  73.         scrnptr= (int far *)MK_FP(scrnseg,offset);
  74.         TextFill(rows, cols, scrnptr, attr);
  75.      }
  76.      qbox (temp->urow,temp->ucol,temp->lrow,temp->lcol);
  77.      temp->attr = (char) ((bclr << 4) + fclr);
  78.      set_cursor_pos(ur+1,uc+1);
  79.      return(temp);
  80. }
  81.