blob: f31291447a928c0d35c7bb6994ec9f8a7842b0a9 (
plain)
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
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
|
class G_ShipObject : public ShipObject
{
protected:
public:
int BoostEnergy( int nEnergy )
{
if ( CurEnergy == MaxEnergy ) {
return FALSE;
} else {
CurEnergy += nEnergy;
if ( CurEnergy > MaxEnergy ) {
CurEnergy = MaxEnergy;
}
return TRUE;
}
}
int BoostRepair( int nRepair )
{
if ( CurDamage == 0 ) {
return FALSE;
} else {
CurDamage -= nRepair;
if ( CurDamage < 0 ) {
CurDamage = 0;
}
return TRUE;
}
}
int BoostMissiles( int nNumMissiles )
{
if ( NumMissls == MaxNumMissls ) {
return FALSE;
} else {
NumMissls += nNumMissiles;
if ( NumMissls > MaxNumMissls ) {
NumMissls = MaxNumMissls;
}
return TRUE;
}
}
int BoostHomMissiles( int nNumMissiles )
{
if ( NumHomMissls == MaxNumHomMissls ) {
return FALSE;
} else {
NumHomMissls += nNumMissiles;
if ( NumHomMissls > MaxNumHomMissls ) {
NumHomMissls = MaxNumHomMissls;
}
return TRUE;
}
}
int BoostPartMissiles( int nNumMissiles )
{
if ( NumPartMissls == MaxNumPartMissls ) {
return FALSE;
} else {
NumPartMissls += nNumMissiles;
if ( NumPartMissls > MaxNumPartMissls ) {
NumPartMissls = MaxNumPartMissls;
}
return TRUE;
}
}
int BoostMines( int nMines )
{
if ( NumMines == MaxNumMines ) {
return FALSE;
} else {
NumMines += nMines;
if ( NumMines > MaxNumMines ) {
NumMines = MaxNumMines;
}
return TRUE;
}
}
int CollectDevice( int mask )
{
if ( ( Weapons & mask ) == 0 ) {
Weapons |= mask;
return TRUE;
} else {
return FALSE;
}
}
// enable afterburner function ------------------------------------------------
//
void EnableAfterBurner()
{
// set active flag
Specials |= SPMASK_AFTERBURNER;
afterburner_energy = AFTERBURNER_ENERGY;
}
// enable invisibility function -----------------------------------------------
//
void EnableInvisibility()
{
// set active flag
Specials |= SPMASK_INVISIBILITY;
//TODO:
// well, nobody got around to implementing this :)
}
// enable invulnerability function --------------------------------------------
//
void EnableInvulnerability()
{
#ifdef PARSEC_CLIENT
// create particle cluster visualizing invulnerability shield
if ( SFX_EnableInvulnerabilityShield( (ShipObject*)this ) ) {
// set active flag
Specials |= SPMASK_INVULNERABILITY;
// set shield strength
MegaShieldAbsorption = MegaShieldStrength;
}
#elif defined ( PARSEC_SERVER )
// set active flag
Specials |= SPMASK_INVULNERABILITY;
// set shield strength
MegaShieldAbsorption = TheGame->MegaShieldStrength;
#endif
}
// enable decoy device --------------------------------------------------------
//
void EnableDecoy()
{
// set active flag
Specials |= SPMASK_DECOY;
}
// enable laser upgrade 1 ----------------------------------------------------
//
void EnableLaserUpgrade1()
{
// set active flag
Specials |= SPMASK_LASER_UPGRADE_1;
}
// enable laser upgrade 2 ----------------------------------------------------
//
void EnableLaserUpgrade2()
{
// set active flag
Specials |= SPMASK_LASER_UPGRADE_2;
}
// enable emp upgrade 1 ------------------------------------------------------
//
void EnableEmpUpgrade1()
{
// set active flag
Specials |= SPMASK_EMP_UPGRADE_1;
}
// enable emp upgrade 2 ------------------------------------------------------
//
void EnableEmpUpgrade2()
{
// set active flag
Specials |= SPMASK_EMP_UPGRADE_2;
}
int CollectSpecial( int mask )
{
switch( mask ) {
case SPMASK_AFTERBURNER:
EnableAfterBurner();
break;
case SPMASK_INVISIBILITY:
EnableInvisibility();
break;
case SPMASK_INVULNERABILITY:
EnableInvulnerability();
break;
case SPMASK_DECOY:
EnableDecoy();
break;
default:
//NOTE: all other specials must be handled by directly calling the Enable* function
ASSERT( FALSE );
break;
}
if ( ( Specials & mask ) == 0 ) {
return TRUE;
} else {
return FALSE;
}
}
};
|