OpenXcom  1.0
Open-source clone of the original X-Com
CraftWeaponProjectile.h
1 #pragma once
2 /*
3  * Copyright 2010-2016 OpenXcom Developers.
4  *
5  * This file is part of OpenXcom.
6  *
7  * OpenXcom is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * OpenXcom is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with OpenXcom. If not, see <http://www.gnu.org/licenses/>.
19  */
20 namespace OpenXcom {
21 
22 class Surface;
23 
24 // Do not change the order of these enums because they are related to blob order.
25 enum CraftWeaponProjectileType { CWPT_STINGRAY_MISSILE, CWPT_AVALANCHE_MISSILE, CWPT_CANNON_ROUND, CWPT_FUSION_BALL, CWPT_LASER_BEAM, CWPT_PLASMA_BEAM };
26 enum CraftWeaponProjectileGlobalType { CWPGT_MISSILE, CWPGT_BEAM };
27 enum Directions { D_NONE, D_UP, D_DOWN };
28 const int HP_LEFT = -1;
29 const int HP_CENTER = 0;
30 const int HP_RIGHT = 1;
31 
33 {
34 private:
35  CraftWeaponProjectileType _type;
36  CraftWeaponProjectileGlobalType _globalType;
37  int _speed;
38  int _direction;
39  int _currentPosition; // relative to interceptor, apparently, which is a problem when the interceptor disengages while projectile is in flight
40  int _horizontalPosition;
41  int _state;
42  int _accuracy;
43  int _damage;
44  int _range;
45  bool _toBeRemoved;
46  bool _missed;
47 
48  int _distanceCovered;
49 
50 public:
52  ~CraftWeaponProjectile(void);
53 
55  void setType(CraftWeaponProjectileType type);
57  CraftWeaponProjectileType getType() const;
59  CraftWeaponProjectileGlobalType getGlobalType() const;
61  void setDirection(const int &directon);
63  int getDirection() const;
65  void move();
67  int getPosition() const;
69  void setPosition(const int &position);
71  void setHorizontalPosition(int position);
73  int getHorizontalPosition() const;
75  void remove();
77  bool toBeRemoved() const;
79  int getState() const;
81  void setDamage(const int &damage);
83  int getDamage() const;
85  void setAccuracy(const int &accuracy);
87  int getAccuracy() const;
89  void setMissed(const bool &missed);
91  bool getMissed() const;
93  void setRange(const int &range);
95  int getRange() const;
97  void setSpeed(const int speed);
98 };
99 
100 }
void setDirection(const int &directon)
Sets projectile direction. This determines it&#39;s initial position.
Definition: CraftWeaponProjectile.cpp:68
int getDirection() const
Gets projectile direction.
Definition: CraftWeaponProjectile.cpp:80
CraftWeaponProjectileType getType() const
Returns projectile type.
Definition: CraftWeaponProjectile.cpp:51
void setHorizontalPosition(int position)
Sets horizontal position. This determines from which weapon projectile has been fired.
Definition: CraftWeaponProjectile.cpp:144
bool getMissed() const
Gets the projectile missed status.
Definition: CraftWeaponProjectile.cpp:227
void setMissed(const bool &missed)
Sets the projectile to missed status.
Definition: CraftWeaponProjectile.cpp:218
void move()
Moves projectile in _direction with _speed.
Definition: CraftWeaponProjectile.cpp:89
int getPosition() const
Gets projectile position.
Definition: CraftWeaponProjectile.cpp:135
int getState() const
Returns state of the beam.
Definition: CraftWeaponProjectile.cpp:176
void setType(CraftWeaponProjectileType type)
Sets projectile type. This determines it&#39;s speed.
Definition: CraftWeaponProjectile.cpp:37
int getAccuracy() const
Gets accuracy of the projectile.
Definition: CraftWeaponProjectile.cpp:210
CraftWeaponProjectileGlobalType getGlobalType() const
Returns projectile global type.
Definition: CraftWeaponProjectile.cpp:60
void setDamage(const int &damage)
Sets power of the projectile.
Definition: CraftWeaponProjectile.cpp:185
void setRange(const int &range)
Sets maximum range of projectile.
Definition: CraftWeaponProjectile.cpp:235
void setAccuracy(const int &accuracy)
Sets accuracy of the projectile.
Definition: CraftWeaponProjectile.cpp:202
void setSpeed(const int speed)
Sets the speed of a missile type projectile.
Definition: CraftWeaponProjectile.cpp:251
bool toBeRemoved() const
Returns true if the projectile should be removed.
Definition: CraftWeaponProjectile.cpp:168
int getDamage() const
Gets power of the projectile.
Definition: CraftWeaponProjectile.cpp:194
int getRange() const
Gets maximum range of projectile.
Definition: CraftWeaponProjectile.cpp:243
int getHorizontalPosition() const
Gets horizontal position.
Definition: CraftWeaponProjectile.cpp:152
void setPosition(const int &position)
Sets projectile position.
Definition: CraftWeaponProjectile.cpp:127
Definition: BaseInfoState.cpp:40
Definition: CraftWeaponProjectile.h:32