File: hull_weapon_dissipate.cpp

package info (click to toggle)
rafkill 1.2.2-3.3
  • links: PTS
  • area: main
  • in suites: wheezy
  • size: 13,268 kB
  • sloc: cpp: 13,508; makefile: 64; sh: 14
file content (56 lines) | stat: -rw-r--r-- 1,391 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
44
45
46
47
48
49
50
51
52
53
54
55
56
#include "hull.h"
#include "hull_weapon_dissipate.h"
#include "spaceobj.h"
#include "ebox.h"
#include "defs.h"
#include "trigtable.h"

const int MAX_DISSIPATE_SHADE = 25;

Dissipate_WHull::Dissipate_WHull( int life, ECollide * ec ):
HullWeapon( 0, life, 1 ) {
	shade = new int[ MAX_DISSIPATE_SHADE ];
	mlife = life;
	Util::blend_palette( shade, MAX_DISSIPATE_SHADE, Bitmap::makeColor(10,10,0), Bitmap::makeColor(245,0,5) );
	collide = ec;

	strength = (int)( fsqr((double)life+(double)mlife/5.0) * 1.19 );
	strength = 0;
}


void Dissipate_WHull::Draw( const Bitmap & who, int x, int y ) {
	// circlefill( who, x, y, 6, shade[ (int)((double)life/(double)mlife*(double)(MAX_DISSIPATE_SHADE-1))] );
	int color = (int)((double)life/(double)mlife*(double)(MAX_DISSIPATE_SHADE-1));
	who.circleFill( x, y, 6, shade[ color ] );
}


void Dissipate_WHull::Moved( double _dx, double _dy, double _ax, double _ay ) {
	strength = (int)( fsqr( ((double)life+(double)mlife/2.0) / 20 ) * 1.19 );
	if ( strength < 1 ) strength = 1;
}


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

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

		int tx = (int)(mx + tcos[ang]*6 );
		int ty = (int)(my + tsine[ang]*6 );
		if ( check->HitMe( tx, ty ) )
			return true;

}

return false;

}
*/

Dissipate_WHull::~Dissipate_WHull() {
	delete[] shade;
}