File: hull_weapon_pulse_large.cpp

package info (click to toggle)
rafkill 1.2.2-4
  • links: PTS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 13,268 kB
  • ctags: 5,074
  • sloc: cpp: 13,508; makefile: 64; sh: 14
file content (43 lines) | stat: -rw-r--r-- 998 bytes parent folder | download | duplicates (12)
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
#include "spaceobj.h"
#include "bitmap.h"
#include "hull_weapon.h"
#include "trigtable.h"
#include "hull_weapon_pulse_large.h"

LargePulse_WHull::LargePulse_WHull():
HullWeapon( 0, 1, 3 ){}

void LargePulse_WHull::Draw( const Bitmap & who, int x, int y ) {

	for ( int tri = 0; tri < 2; tri++ ) {

		int x1 = x + Util::rnd(7) - 3;
		int x2 = x + Util::rnd(7) - 3;
		int y1 = y + 10 + Util::rnd(8);
		who.triangle( x1,  y, x2, y, (x1+x2)/2, y1-2, Bitmap::makeColor(255,20,0));
		who.triangle( x1,  y, x2, y, (x1+x2)/2, y1, Bitmap::makeColor(240,20,0) );

	}

	who.ellipseFill( x, y-1, 3, 6, Bitmap::makeColor(255,0,0) );
	who.ellipseFill( x, y, 3, 6, Bitmap::makeColor(240,100,0) );

}


bool LargePulse_WHull::Collide( int mx, int my, SpaceObject * check ) {
	if ( check->HitMe( mx, my ) )
		return true;

	for ( int ang = 0; ang < 360; ang += 65 ) {

		int tx = (int)(mx + Tcos(ang)*6 );
		int ty = (int)(my + Tsine(ang)*6 );
		if ( check->HitMe( tx, ty ) )
			return true;

	}

	return false;

}