File: weapon_shatter.cpp

package info (click to toggle)
rafkill 1.2.2-3.2
  • links: PTS
  • area: main
  • in suites: lenny, squeeze
  • size: 13,264 kB
  • ctags: 5,074
  • sloc: cpp: 13,508; makefile: 64; sh: 14
file content (38 lines) | stat: -rw-r--r-- 1,082 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
#include "weapon_shatter.h"
#include "weapon_bounce.h"
#include "weaponobj.h"
#include "hull.h"
#include "trigtable.h"
#include "sound.h"
#include "hulls/hull_weapon_shatter.h"
#include "hulls/hull_weapon_machine.h"

Shatter::Shatter( int qx, int qy, double kx, double ky, HullObject * hnew, int al, vector< SpaceObject * > * Ammo ):
WeaponNode(qx,qy,kx,ky,hnew, al) {
	myAmmo = Ammo;
}

bool Shatter::Damage( double much ) {
	if ( !hull ) return true;
	hull->takeDamage( getLife() );
	return true;
	// return ( getLife() <= 0 );
}

void Shatter::Died(SpaceObject * check,ExplosionClass ** explr,int ME ){

	Util::playSound( SND_SUSTAIN, 50 );
	Explode( explr, ME );

	if ( myAmmo == NULL ) return;
	for ( int q = 0; q < hull->strength*3; q++ ) {
		int ang = Util::rnd( 360 );

		HullObject * add_h = new Machine_WHull( 1 );
		add_h->life = 4;
		myAmmo->push_back( new Bounce(getX(),getY(),Tcos(ang)*2.1,Tsine(ang)*2.1,add_h,alignment ) );

		//myAmmo->add( new Shatter(actualx,actualy,tcos[ang]*2.1,tsine[ang]*2.1, new Shatter_WHull(hull->strength/2), alignment, myAmmo ) );
	}

}