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