File: gun_machine_circle.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 (46 lines) | stat: -rw-r--r-- 1,101 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
#include "gunobj.h"
#include "gun_machine_circle.h"
#include "weaponobj.h"
#include "hulls/hull_weapon_machine.h"
#include "trigtable.h"

// #define d_circle_move (2.9*8)

WeaponMachineCircleGun::WeaponMachineCircleGun( int z, int d, int _smp, int al ):
WeaponObject( d, "Radix Gun", 25000, al, z, 4 ),
angle( 0 ) {
	smp = _smp;
}


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


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

	if ( smp != -1 ){
		Util::playSound( smp, 255 );
	}

	shot_counter = 1;
	angle = (angle + 20 ) % 360;

	const double d_circle_move = 2.9 * 8;

	for ( int q = -(30+strength*2); q < 30+strength*2; q += 7-strength ) {

		int ra = ( angle + q + 360 ) % 360;
		int bul;
		if ( q != 0 )
			bul = (strength+1)*11 / abs( q );
		else bul = 3;

		if ( bul > 3 ) bul = 3;
		if ( bul < 1 ) bul = 1;
		Ammo->push_back( new WeaponNode(x,y,Tcos(ra)*d_circle_move,Tsine(ra)*d_circle_move, new Machine_WHull(bul), alignment ) );

	}

}