File: gun_beam.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 (54 lines) | stat: -rw-r--r-- 1,063 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
#include "gunobj.h"
#include "gun_beam.h"
// #include "spaceobj.h"

#include "weapons/weapon_beam.h"
#include "hulls/hull_weapon_beam.h"
#include <vector>

using namespace std;

WeaponBeam::WeaponBeam( int z, int d, int al ):
WeaponObject( d, "Beam", 36300, al, z, 6 ),
tear( 90 ),
length( 0 ),
fat( 20 ),
angle( 0 ) {
}


void WeaponBeam::Idle( int x, int y, vector< SpaceObject * > * Ammo, const vector< SpaceObject * > * fight ) {
	tear = 0;
}


void WeaponBeam::MakeShot(int x, int y, vector< SpaceObject * > * Ammo, const vector< SpaceObject * > * fight ) {

	shot_counter = 30;
	if ( tear > 0 ) {
		shot_counter = 0;
		tear--;
		length += 63;
		if( length > 480 ) length = 480;
		fat--;
		if ( fat < 1 ) {
			fat = 1;
			tear = 0;
		}
	}
	else {
		tear = 90;
		length = 0;
		fat = 18+(strength+1)*3;
		return;
	}

	angle = (angle-17+360) % 360;
	Ammo->push_back( new Beam(x,y-length/2,0,0,1, new Beam_WHull((strength+1.0)*2.0,fat*2,length,angle), alignment ) );

}


WeaponObject * WeaponBeam::copy() {
	return new WeaponBeam( strength, dir, alignment );
}