Debian Codegraph @

engine/include/construct.h

raw
1 // ____ _ __
2 // / __ )____ _____ | | / /___ ___________
3 // / __ / __ \/ ___/ | | /| / / __ `/ ___/ ___/
4 // / /_/ / /_/ (__ ) | |/ |/ / /_/ / / (__ )
5 // /_____/\____/____/ |__/|__/\__,_/_/ /____/
6 //
7 // A futuristic real-time strategy game.
8 // This file is part of Bos Wars.
9 //
10 /**@name construct.h - The constructions headerfile. */
11 //
12 // (c) Copyright 1998-2007 by Lutz Sammer and Jimmy Salmon
13 //
14 // This program is free software; you can redistribute it and/or modify
15 // it under the terms of the GNU General Public License as published by
16 // the Free Software Foundation; only version 2 of the License.
17 //
18 // This program is distributed in the hope that it will be useful,
19 // but WITHOUT ANY WARRANTY; without even the implied warranty of
20 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 // GNU General Public License for more details.
22 //
23 // You should have received a copy of the GNU General Public License
24 // along with this program; if not, write to the Free Software
25 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
26 // 02111-1307, USA.
27
28 #ifndef __CONSTRUCT_H__
29 #define __CONSTRUCT_H__
30
31 //@{
32
33 /*----------------------------------------------------------------------------
34 -- Documentation
35 ----------------------------------------------------------------------------*/
36
37 /**
38 ** @class CConstruction construct.h
39 **
40 ** \#include "construct.h"
41 **
42 ** Each building perhaps also units can have its own construction
43 ** frames. This construction frames are currently not animated,
44 ** this is planned for the future. What construction frames a
45 ** building has, is handled by UnitType::Construction.
46 **
47 ** The construction structure members:
48 **
49 ** CConstruction::Ident
50 **
51 ** Unique identifier of the construction, used to reference it in
52 ** the config files and during startup. As convention they start
53 ** with "construction-" fe. "construction-land".
54 ** @note Don't use this member in game, use instead the pointer
55 ** to this structure. See ConstructionByIdent().
56 **
57 ** CConstruction::File
58 **
59 ** Path file name of the sprite file.
60 **
61 ** CConstruction::ShadowFile
62 **
63 ** Path file name of shadow sprite file.
64 **
65 ** CConstruction::Frames
66 **
67 ** Frames of the construction sequence.
68 **
69 ** CConstruction::Sprite
70 **
71 ** Sprite image.
72 **
73 ** CConstruction::Width CConstruction::Height
74 **
75 ** Size of a sprite frame in pixels. All frames of a sprite have
76 ** the same size. Also all sprites (tilesets) must have the same
77 ** size.
78 **
79 ** CConstruction::ShadowSprite
80 **
81 ** Shadow sprite image.
82 **
83 ** CConstruction::ShadowWidth CConstruction::ShadowHeight
84 **
85 ** Size of a shadow sprite frame in pixels. All frames of a sprite
86 ** have the same size. Also all sprites (tilesets) must have the
87 ** same size.
88 */
89
90 /*----------------------------------------------------------------------------
91 -- Declarations
92 ----------------------------------------------------------------------------*/
93
94 class CGraphic;
95 class CPlayerColorGraphic;
96
97
98 enum ConstructionFileType {
99 ConstructionFileConstruction,
100 ConstructionFileMain,
101 };
102
103 /// Construction frame
104 class CConstructionFrame {
105 public:
106 CConstructionFrame() : Percent(0), File(ConstructionFileConstruction),
107 Frame(0), Next(NULL) {}
108
109 int Percent; /// Percent complete
110 ConstructionFileType File; /// Graphic to use
111 int Frame; /// Frame number
112 CConstructionFrame *Next; /// Next pointer
113 };
114
115 /// Construction shown during construction of a building
116 class CConstruction {
117 public:
118 CConstruction() : Frames(NULL), Sprite(NULL), Width(0),
119 Height(0), ShadowSprite(NULL), ShadowWidth(0), ShadowHeight(0)
120 {
121 File.Width = 0;
122 File.Height = 0;
123 ShadowFile.Width = 0;
124 ShadowFile.Height = 0;
125 }
126
127 std::string Ident; /// construction identifier
128 struct {
129 std::string File;/// sprite file
130 int Width; /// sprite width
131 int Height; /// sprite height
132 } File, ShadowFile;
133 CConstructionFrame *Frames; /// construction frames
134
135 // --- FILLED UP ---
136
137 CPlayerColorGraphic *Sprite;/// construction sprite image
138 int Width; /// sprite width
139 int Height; /// sprite height
140 CGraphic *ShadowSprite; /// construction shadow sprite image
141 int ShadowWidth; /// shadow sprite width
142 int ShadowHeight; /// shadow sprite height
143 };
144
145 /*----------------------------------------------------------------------------
146 -- Macros
147 ----------------------------------------------------------------------------*/
148
149 /*----------------------------------------------------------------------------
150 -- Variables
151 ----------------------------------------------------------------------------*/
152
153 /*----------------------------------------------------------------------------
154 -- Functions
155 ----------------------------------------------------------------------------*/
156
157 /// Initialize the constructions module
158 extern void InitConstructions(void);
159 /// Load the graphics for constructions
160 extern void LoadConstructions(void);
161 /// Clean up the constructions module
162 extern void CleanConstructions(void);
163 /// Get construction by identifier
164 extern CConstruction *ConstructionByIdent(const std::string &ident);
165
166 /// Register ccl features
167 extern void ConstructionCclRegister(void);
168
169 //@}
170
171 #endif // !__CONSTRUCT_H__