home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c185 / 2.ddi / OWLSRC.EXE / CSCAPE / SOURCE / EXPBMU.C < prev    next >
Encoding:
C/C++ Source or Header  |  1989-09-06  |  1.4 KB  |  65 lines

  1. /*
  2.     expbmu.c
  3.  
  4.     % Beam Me Up Explode function for windows
  5.  
  6.     OWL 1.1
  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. */
  18.  
  19.  
  20. #include "oakhead.h"
  21. #include "disppriv.h"
  22. #include "explode.h"
  23.  
  24. #define COUNT 400
  25.  
  26. #define EXP_CHARS    "*!. "
  27.  
  28. int exp_BeamMeUp(objdata, msg, indata, outdata)
  29.     VOID *objdata;            /* calling object's instance data pointer (ignored) */
  30.     int msg;                /* message */
  31.     VOID *indata;            /* message input data */
  32.     VOID *outdata;            /* message output data */
  33. /*
  34.     "Beam Me Up" explode function.
  35. */
  36. {
  37.     ptd_struct *ptd;
  38.     int            hgt, wid, i;
  39.     byte            attr;
  40.     char            expchar[2];
  41.  
  42.     /* objdata is ignored. */ oak_notused(objdata);
  43.     /* outdata is not used. */ oak_notused(outdata);
  44.  
  45.     switch (msg) {
  46.     case WINM_EXPLODE:
  47.         /* paint random dots within the window for a while */
  48.         ptd = (ptd_struct *)indata;
  49.  
  50.         hgt = win_GetHeight(ptd->win);
  51.         wid = win_GetWidth(ptd->win);
  52.         attr = win_GetAttr(ptd->win);
  53.         expchar[1] = '\0';         /* terminate, cause I'm a good boy */
  54.  
  55.         for (i = 0; i < COUNT; i++) {
  56.             expchar[0] = *(EXP_CHARS + rand() % sizeof(EXP_CHARS));
  57.             ptd_DrawString(ptd, rand() % hgt, rand() % wid, expchar, attr, 1);
  58.         }
  59.         break;
  60.     }
  61.  
  62.     return(TRUE);
  63. }
  64.  
  65.