File: water.c

package info (click to toggle)
gravitywars 1.102-34
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, sid, stretch
  • size: 2,468 kB
  • ctags: 553
  • sloc: ansic: 3,938; makefile: 52; sh: 52
file content (48 lines) | stat: -rw-r--r-- 856 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/* GravityWars 1.1,  (C) Sami Niemi -95 */

#include "memory.h"


/*----------------------------------------------------------------watermask */
/* Raterize the ship when in the water, and only to a certain height.. */

void watermask(short x, short y, uchar type, char *back_adr) {

  static short xx,yy,n;
  static uchar *mix_adr;
  static uchar *ship_adr;
  static uchar col;
  static short m,start;

  y-=9;

  if (type==E_WATER)
    start=0;
  else {
    start=(y & 65504)+32-y; 
    if (start>25) start=0;
  }

  m=(x^y);

  mix_adr=shipmix;
  ship_adr=ship[1+(g_flag & 1)][sa[0] >> 5];

  n=0;
  for(yy=0; yy<=31; yy++) { 
    for(xx=0; xx<=31; xx++,n++) {
      col=ship_adr[n];
      if (col!=0) {
	if ( (((xx^yy)^m)&1) && (yy>start)) {
	  col=WATERCOLOR;
	}
      }
      else { 
	col=back_adr[n];
      }
      mix_adr[n]=col;
    }  
  }
}