1 /*
2  *  This file is part of Dune Legacy.
3  *
4  *  Dune Legacy is free software: you can redistribute it and/or modify
5  *  it under the terms of the GNU General Public License as published by
6  *  the Free Software Foundation, either version 2 of the License, or
7  *  (at your option) any later version.
8  *
9  *  Dune Legacy is distributed in the hope that it will be useful,
10  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
11  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
12  *  GNU General Public License for more details.
13  *
14  *  You should have received a copy of the GNU General Public License
15  *  along with Dune Legacy.  If not, see <http://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef DATA_H
19 #define DATA_H
20 
21 // data definitions
22 typedef enum {
23     Bullet_DRocket = 0,
24     Bullet_LargeRocket = 1,
25     Bullet_Rocket = 2,
26     Bullet_TurretRocket = 3,
27     Bullet_ShellSmall = 4,
28     Bullet_ShellMedium = 5,
29     Bullet_ShellLarge = 6,
30     Bullet_ShellTurret = 7,
31     Bullet_SmallRocket = 8,
32     Bullet_Sonic = 9,
33     Bullet_Sandworm = 10
34 } BulletID_enum;
35 
36 typedef enum {
37     Explosion_Small = 0,
38     Explosion_Medium1 = 1,
39     Explosion_Medium2 = 2,
40     Explosion_Large1 = 3,
41     Explosion_Large2 = 4,
42     Explosion_Gas = 5,
43     Explosion_ShellSmall = 6,
44     Explosion_ShellMedium = 7,
45     Explosion_ShellLarge = 8,
46     Explosion_SmallUnit = 9,
47     Explosion_Flames = 10,
48     Explosion_SpiceBloom = 11
49 } ExplosionID_enum;
50 
51 typedef enum {
52     ItemID_Invalid = 0,
53     ItemID_FirstID = 1,
54 
55     Structure_FirstID = 1,
56     Structure_Barracks = 1,
57     Structure_ConstructionYard = 2,
58     Structure_GunTurret = 3,
59     Structure_HeavyFactory = 4,
60     Structure_HighTechFactory = 5,
61     Structure_IX = 6,
62     Structure_LightFactory = 7,
63     Structure_Palace = 8,
64     Structure_Radar = 9,
65     Structure_Refinery = 10,
66     Structure_RepairYard = 11,
67     Structure_RocketTurret = 12,
68     Structure_Silo = 13,
69     Structure_Slab1 = 14,
70     Structure_Slab4 = 15,
71     Structure_StarPort = 16,
72     Structure_Wall = 17,
73     Structure_WindTrap = 18,
74     Structure_WOR = 19,
75     Structure_LastID = 19,
76 
77     Unit_FirstID = 20,
78     Unit_Carryall = 20,
79     Unit_Devastator = 21,
80     Unit_Deviator = 22,
81     Unit_Frigate = 23,
82     Unit_Harvester = 24,
83     Unit_Soldier = 25,
84     Unit_Launcher = 26,
85     Unit_MCV = 27,
86     Unit_Ornithopter = 28,
87     Unit_Quad = 29,
88     Unit_Saboteur = 30,
89     Unit_Sandworm = 31,
90     Unit_SiegeTank = 32,
91     Unit_SonicTank = 33,
92     Unit_Tank = 34,
93     Unit_Trike = 35,
94     Unit_RaiderTrike = 36,
95     Unit_Trooper = 37,
96     Unit_Special = 38,
97     Unit_Infantry = 39,
98     Unit_Troopers = 40,
99     Unit_LastID = 40,
100     ItemID_LastID = 40,
101 
102     Num_ItemID
103 } ItemID_enum;
104 
105 typedef enum {
106     Terrain_Slab,
107     Terrain_Sand,
108     Terrain_Rock,
109     Terrain_Dunes,
110     Terrain_Mountain,
111     Terrain_Spice,
112     Terrain_ThickSpice,
113     Terrain_SpiceBloom,
114     Terrain_SpecialBloom
115 } TERRAINTYPE;
116 
117 typedef enum {
118     Terrain_HiddenIsland    = 0x0,
119     Terrain_HiddenUp        = 0x1,
120     Terrain_HiddenRight     = 0x2,
121     Terrain_HiddenUpRight   = 0x3,
122     Terrain_HiddenDown      = 0x4,
123     Terrain_HiddenUpDown    = 0x5,
124     Terrain_HiddenDownRight = 0x6,
125     Terrain_HiddenNotLeft   = 0x7,
126     Terrain_HiddenLeft      = 0x8,
127     Terrain_HiddenUpLeft    = 0x9,
128     Terrain_HiddenLeftRight = 0xA,
129     Terrain_HiddenNotDown   = 0xB,
130     Terrain_HiddenDownLeft  = 0xC,
131     Terrain_HiddenNotRight  = 0xD,
132     Terrain_HiddenNotUp     = 0xE,
133     Terrain_HiddenFull      = 0xF
134 } HIDDENTYPE;
135 
136 /**
137     This function determines if the specified itemID is an unit or not.
138     \param itemID   the ID of the item (e.g. Unit_Harvester)
139     \return true if it is an unit, false otherwise
140 */
isUnit(int itemID)141 inline bool isUnit(int itemID) { return (itemID >= Unit_FirstID && itemID <= Unit_LastID); }
142 
143 /**
144     This function determines if the specified itemID is a structure or not.
145     \param itemID   the ID of the item (e.g. Structure_ConstructionYard)
146     \return true if it is a structure, false otherwise
147 */
isStructure(int itemID)148 inline bool isStructure(int itemID) { return (itemID >= Structure_FirstID && itemID <= Structure_LastID); }
149 
150 
151 /**
152     This function determines if the specified itemID is a flying unit or not.
153     \param itemID   the ID of the item (e.g. Unit_Carryall)
154     \return true if it is a flying unit, false otherwise
155 */
isFlyingUnit(int itemID)156 inline bool isFlyingUnit(int itemID) { return (itemID == Unit_Carryall) || (itemID == Unit_Ornithopter) || (itemID == Unit_Frigate); }
157 
158 /**
159     This function determines if the specified itemID is an infantry unit or not.
160     \param itemID   the ID of the item (e.g. Unit_Carryall)
161     \return true if it is an infantry unit, false otherwise
162 */
isInfantryUnit(int itemID)163 inline bool isInfantryUnit(int itemID) { return (itemID == Unit_Soldier) || (itemID == Unit_Trooper) || (itemID == Unit_Infantry) || (itemID == Unit_Troopers) || (itemID == Unit_Saboteur); }
164 
165 
166 #endif // DATA_H
167