# 2.11BSD#431 - /usr/src/games/warp/bang.c

##### Functions

    bang_init         X
    do_bangs          X
    make_blast        X
    make_plink        X

       1: /* $Header: bang.c,v 7.0.1.3 86/12/12 16:57:00 lwall Exp $ */
       2:
       3: /* $Log:	bang.c,v $
       4:  * Revision 7.0.1.3  86/12/12  16:57:00  lwall
       5:  * Made circular explosions.
       6:  *
       7:  * Revision 7.0.1.2  86/10/20  14:36:02  lwall
       8:  * Picked some lint.
       9:  *
      10:  * Revision 7.0.1.1  86/10/16  10:49:45  lwall
      11:  * Added Damage.  Fixed random bugs.
      12:  *
      13:  * Revision 7.0  86/10/08  15:11:57  lwall
      14:  * Split into separate files.  Added amoebas and pirates.
      15:  *
      16:  */
      17:
      18: #include "EXTERN.h"
      19: #include "warp.h"
      20: #include "object.h"
      21: #include "move.h"
      22: #include "sig.h"
      23: #include "term.h"
      24: #include "them.h"
      25: #include "INTERN.h"
      26: #include "bang.h"
      27:
      28: void
      29: bang_init()
      30: {
      31:     ;
      32: }
      33:
      34: void
      35: make_plink(y,x)
      36: Reg1 int x;
      37: Reg2 int y;
      38: {
      39:     Reg3 OBJECT *obj;
      40:
      41:     move(y+1,x*2,0);
      42:     beg_qwrite();
      43:     *filler = '@';
      44:     qwrite();
      45:     obj = occupant[y][x];
      46:     if (obj) {
      47:     if (numamoebas && obj->image == ' ')
      48:         qaddc(amb[y][x]);
      49:     else
      50:         qaddc(obj->image);
      51:     }
      52:     else if (numamoebas)
      53:     qaddc(amb[y][x]);
      54:     else
      55:     qaddspace();
      56:     end_qwrite();
      57: }
      58:
      59: void
      60: make_blast(y,x,mass,size)
      61: Reg1 int x;
      62: Reg2 int y;
      63: int size;
      64: long mass;
      65: {
      66:     bangy[nxtbang] = y;
      67:     bangx[nxtbang] = x;
      68:     bangm[nxtbang] = mass;
      69:     bangs[nxtbang++] = size;
      70:     assert(nxtbang <= XSIZE * YSIZE);
      71:     if (numamoebas && amb[y][x] == '~') {
      72:     if (mass > 10000)
      73:         modify_amoeba(y,x,1,'~', 10);
      74:     else if (mass > 100)
      75:         modify_amoeba(y,x,1,'~', 5);
      76:     bangs[nxtbang-1] = 0;       /* don't propagate */
      77:     return;
      78:     }
      79:     else if (mass >= 0) {
      80:     Reg3 OBJECT *obj;
      81:
      82:     move(y+1,x*2,0);
      83:     beg_qwrite();
      84:     *filler = '@';
      85:     qwrite();
      86:     *filler = '#';
      87:     qwrite();
      88:     *filler = '@';
      89:     qwrite();
      90:     *filler = '#';
      91:     qwrite();
      92:     *filler = '@';
      93:     qwrite();
      94:     obj = occupant[y][x];
      95:     if (obj) {
      96:         if (numamoebas && obj->image == ' ')
      97:         qaddc(amb[y][x]);
      98:         else
      99:         qaddc(obj->image);
     100:     }
     101:     else if (numamoebas)
     102:         qaddc(amb[y][x]);
     103:     else
     104:         qaddspace();
     105:     end_qwrite();
     106:     }
     107: }
     108:
     109: void
     110: do_bangs()
     111: {
     112:     Reg1 int x;
     113:     Reg2 int y;
     114:     Reg3 int i;
     115:     Reg4 int j;
     116:     Reg7 int k;
     117:     Reg5 int lastxy;
     118:     Reg6 OBJECT *obj;
     119:
     120:     /* read blast list and update blast array */
     121:     assert(nxtbang >= 0 && nxtbang <= XSIZE * YSIZE);
     122:     for (i=0; i<nxtbang; i++) {
     123:     if (bangm[i] != 32767)
     124:         bangm[i] *= 4;
     125:     lastxy = bangs[i] << 1;
     126:     if (lastxy >= MAXBDIST)
     127:         lastxy = MAXBDIST - 1;
     128:     for (y=bangy[i]-bangs[i],x=bangx[i]-bangs[i],j=lastxy;
     129:       j>=0;
     130:       y++,x++,--j) {
     131:         yblasted[yy[j] = (y+YSIZE00) % YSIZE] |= 1;
     132:         xblasted[xx[j] = (x+XSIZE00) % XSIZE] |= 1;
     133:     }
     134:     blasted = TRUE;
     135:     for (y=lastxy;y>=0;--y) {
     136:         for (x=lastxy;x>=0;--x) {
     137:         if (lastxy > 2) {
     138:             j = abs(y-bangs[i]);
     139:             k = abs(x-bangs[i]);
     140:             if (j < k)      /* distance is long + 1/2 short */
     141:             j += k + k;
     142:             else
     143:             j += j + k;
     144:             if (--j > lastxy)
     145:             continue;
     146:         }
     147:         if (bangm[i] != 32767 ||
     148:           !(obj=occupant[yy[y]][xx[x]]) || obj->type != Web)
     149:             blast[yy[y]][xx[x]] += bangm[i];
     150:         }
     151:     }
     152:     }
     153: }

#### Defined functions

bang_init defined in line 28; used 2 times

- in /usr/src/games/warp/bang.h line 30
- in /usr/src/games/warp/warp.c line 292

do_bangs defined in line 109; used 2 times

- in /usr/src/games/warp/bang.h line 29
- in /usr/src/games/warp/move.c line 547

make_blast defined in line 59; used 16 times

- in /usr/src/games/warp/bang.h line 28
- in /usr/src/games/warp/move.c line 321, 382-406(9), 465, 514
- in /usr/src/games/warp/us.c line 325, 337, 345

make_plink defined in line 34; used 4 times

- in /usr/src/games/warp/bang.h line 27
- in /usr/src/games/warp/move.c line 249, 257
- in /usr/src/games/warp/them.c line 97

Last modified: 1987-06-19 Generated: 2016-12-26 | Generated by src2html V0.67 page hit count: 750 |