-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfoecommand.cc.float
135 lines (115 loc) · 3.54 KB
/
foecommand.cc.float
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
/*
* $Id: foecommand.cc,v 1.2 2003/08/15 07:06:52 kenta Exp $
*
* Copyright 2003 Kenta Cho. All rights reserved.
*/
/**
* Handle bullet commands.
*
* @version $Revision: 1.2 $
*/
#include "bulletml/bulletmlparser.h"
#include "bulletml/bulletmlparser-tinyxml.h"
#include "bulletml/bulletmlrunner.h"
#include "foe.h"
extern "C" {
#include "rr.h"
#include "genmcr.h"
#include "degutil.h"
#include "ship.h"
}
FoeCommand::FoeCommand(BulletMLParser *parser, Foe *f)
: BulletMLRunner(parser) {
foe = f;
}
FoeCommand::FoeCommand(BulletMLState *state, Foe *f)
: BulletMLRunner(state) {
foe = f;
}
FoeCommand::~FoeCommand() {}
//senquack - complete conversion to floats:
//double FoeCommand::getBulletDirection() {
// return (double)foe->d*360/DIV;
//}
float FoeCommand::getBulletDirection() {
return (float)foe->d*360/DIV;
}
//senquack - complete conversion to floats:
//double FoeCommand::getAimDirection() {
float FoeCommand::getAimDirection() {
int d = getPlayerDeg(foe->pos.x, foe->pos.y);
if ( foe->xReverse == -1 ) d = (-d)&1023;
// return ((double)d*360/DIV);
return ((float)d*360/DIV);
}
//senquack - complete conversion to floats:
//double FoeCommand::getBulletSpeed() {
// return ((double)foe->spd)/COMMAND_SCREEN_SPD_RATE;
//}
float FoeCommand::getBulletSpeed() {
return ((float)foe->spd)/COMMAND_SCREEN_SPD_RATE;
}
//senquack - complete conversion to floats:
//double FoeCommand::getDefaultSpeed() {
float FoeCommand::getDefaultSpeed() {
return 1;
}
//senquack - complete conversion to floats:
//double FoeCommand::getRank() {
float FoeCommand::getRank() {
return foe->rank;
}
//senquack - complete conversion to floats:
//void FoeCommand::createSimpleBullet(double direction, double speed) {
void FoeCommand::createSimpleBullet(float direction, float speed) {
int d = (int)(direction*DIV/360); d &= (DIV-1);
addFoeNormalBullet(foe, d, (int)(speed*COMMAND_SCREEN_SPD_RATE), foe->color+1);
foe->fireCnt++;
}
//senquack - complete conversion to floats:
//void FoeCommand::createBullet(BulletMLState* state, double direction, double speed) {
void FoeCommand::createBullet(BulletMLState* state, float direction, float speed) {
int d = (int)(direction*DIV/360); d &= (DIV-1);
addFoeActiveBullet(foe, d, (int)(speed*COMMAND_SCREEN_SPD_RATE), foe->color+1, state);
foe->fireCnt++;
}
int FoeCommand::getTurn() {
return tick;
}
void FoeCommand::doVanish() {
removeFoeCommand(foe);
}
//senquack - complete conversion to floats:
//void FoeCommand::doChangeDirection(double d) {
void FoeCommand::doChangeDirection(float d) {
foe->d = (int)(d*DIV/360);
}
//senquack - complete conversion to floats:
//void FoeCommand::doChangeSpeed(double s) {
void FoeCommand::doChangeSpeed(float s) {
foe->spd = (int)(s*COMMAND_SCREEN_SPD_RATE);
}
//senquack - complete conversion to floats:
//void FoeCommand::doAccelX(double ax) {
void FoeCommand::doAccelX(float ax) {
foe->vel.x = (int)(ax*COMMAND_SCREEN_VEL_RATE);
}
//senquack - complete conversion to floats:
//void FoeCommand::doAccelY(double ay) {
void FoeCommand::doAccelY(float ay) {
foe->vel.y = (int)(ay*COMMAND_SCREEN_VEL_RATE);
}
//senquack - complete conversion to floats:
//double FoeCommand::getBulletSpeedX() {
// return ((double)foe->vel.x/COMMAND_SCREEN_VEL_RATE);
//}
float FoeCommand::getBulletSpeedX() {
return ((float)foe->vel.x/COMMAND_SCREEN_VEL_RATE);
}
//senquack - complete conversion to floats:
//double FoeCommand::getBulletSpeedY() {
// return ((double)foe->vel.y/COMMAND_SCREEN_VEL_RATE);
//}
float FoeCommand::getBulletSpeedY() {
return ((float)foe->vel.y/COMMAND_SCREEN_VEL_RATE);
}