File: weapon_rotate.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 (42 lines) | stat: -rw-r--r-- 915 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
#include "weaponobj.h"
#include "weapon_rotate.h"
#include "hull.h"
#include "trigtable.h"

Rotate::Rotate( int qx, int qy, double kx, double ky, int _ang, int _max, HullObject * hnew, int al ):
WeaponNode( qx, qy, kx, ky, hnew, al ),
ang( _ang ),
max( _max ),
rad( 0 ),
dir( 1 ){}

void Rotate::MoveMe( vector< SpaceObject * > * Ammo, const vector< SpaceObject * > * fight, Section * onscreen ){

	MoveReal();
	if ( hull ) hull->Moved( this->getDX(), this->getDY(), this->getAccelX(), this->getAccelY() );

	rad += dir;
	if ( rad < -max ) dir = 1;
	if ( rad > max ) dir = -1;
	setOffsetX( (int)( Tcos( ang ) * rad ) );
	setOffsetY( (int)( Tsine( ang) * rad ) );

}


/*
void Rotate::MoveReal() {

	/ *
	virtualx += dx;
	virtualy += dy;
	actualx = (int)( virtualx + tcos[ang] * rad );
	actualy = (int)( virtualy + tsine[ang] * rad );
	* /

	rad += dir;
	if ( rad < -max ) dir = 1;
	if ( rad > max ) dir = -1;

}
*/