home *** CD-ROM | disk | FTP | other *** search
/ QBasic & Borland Pascal & C / Delphi5.iso / C / Samples / CSAPE32.ARJ / SOURCE / OWLSCR / EXPBMU.C < prev    next >
Encoding:
C/C++ Source or Header  |  1990-03-28  |  1.2 KB  |  62 lines

  1. /*
  2.     expbmu.c
  3.  
  4.     % Beam Me Up Explode function for windows
  5.  
  6.     OWL 1.2
  7.     Copyright (c) 1988, by Oakland Group, Inc.
  8.     ALL RIGHTS RESERVED.
  9.  
  10.     Revision History:
  11.     -----------------
  12.      8/18/88 jmd    created
  13.      9/12/88 jmd    Added in and out data to objects
  14.     12/01/88 jmd    Tidied up
  15.  
  16.      8/13/89 jmd    removed GETEXPLODE message
  17.      3/28/90 jmd    ansi-fied
  18. */
  19.  
  20.  
  21. #include "oakhead.h"
  22. #include "disppriv.h"
  23. #include "explode.h"
  24.  
  25. #define COUNT 400
  26.  
  27. #define EXP_CHARS    "*!. "
  28.  
  29. int exp_BeamMeUp(VOID *objdata, int msg, VOID *indata, VOID *outdata)
  30. /*
  31.     "Beam Me Up" explode function.
  32. */
  33. {
  34.     ptd_struct *ptd;
  35.     int            hgt, wid, i;
  36.     byte            attr;
  37.     char            expchar[2];
  38.  
  39.     /* objdata is ignored. */ oak_notused(objdata);
  40.     /* outdata is not used. */ oak_notused(outdata);
  41.  
  42.     switch (msg) {
  43.     case WINM_EXPLODE:
  44.         /* paint random dots within the window for a while */
  45.         ptd = (ptd_struct *)indata;
  46.  
  47.         hgt = win_GetHeight(ptd->win);
  48.         wid = win_GetWidth(ptd->win);
  49.         attr = win_GetAttr(ptd->win);
  50.         expchar[1] = '\0';         /* terminate, cause I'm a good boy */
  51.  
  52.         for (i = 0; i < COUNT; i++) {
  53.             expchar[0] = *(EXP_CHARS + rand() % sizeof(EXP_CHARS));
  54.             ptd_DrawString(ptd, rand() % hgt, rand() % wid, expchar, attr, 1);
  55.         }
  56.         break;
  57.     }
  58.  
  59.     return(TRUE);
  60. }
  61.  
  62.