1 /***********************************************************************
2  Freeciv - Copyright (C) 1996 - A Kjeldberg, L Gregersen, P Unold
3    This program is free software; you can redistribute it and/or modify
4    it under the terms of the GNU General Public License as published by
5    the Free Software Foundation; either version 2, or (at your option)
6    any later version.
7 
8    This program is distributed in the hope that it will be useful,
9    but WITHOUT ANY WARRANTY; without even the implied warranty of
10    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
11    GNU General Public License for more details.
12 ***********************************************************************/
13 
14 /**********************************************************************
15                           gui_tilespec.h  -  description
16                              -------------------
17     begin                : Dec. 2 2002
18     copyright            : (C) 2002 by Rafał Bursig
19     email                : Rafal Bursig <bursig@poczta.fm>
20  **********************************************************************/
21 
22 #ifndef FC__GUI_TILESPEC_H
23 #define FC__GUI_TILESPEC_H
24 
25 /* SDL */
26 #include <SDL/SDL.h>
27 
28 #include "tilespec.h"
29 
30 #include "graphics.h"
31 #include "sprite.h"
32 
33 struct Theme {
34 
35   /* Frame */
36   SDL_Surface *FR_Left;
37   SDL_Surface *FR_Right;
38   SDL_Surface *FR_Top;
39   SDL_Surface *FR_Bottom;
40 
41   /* Button */
42   SDL_Surface *Button;
43 
44   /* Edit */
45   SDL_Surface *Edit;
46 
47   /* Checkbox */
48   SDL_Surface *CBOX_Sell_Icon;
49   SDL_Surface *CBOX_Unsell_Icon;
50 
51   /* Scrollbar */
52   SDL_Surface *UP_Icon;
53   SDL_Surface *DOWN_Icon;
54   SDL_Surface *LEFT_Icon;
55   SDL_Surface *RIGHT_Icon;
56   SDL_Surface *Vertic;
57   SDL_Surface *Horiz;
58 
59   /* Game */
60   SDL_Surface *OK_Icon;
61   SDL_Surface *CANCEL_Icon;
62   SDL_Surface *Small_OK_Icon;
63   SDL_Surface *Small_CANCEL_Icon;
64   SDL_Surface *FORWARD_Icon;
65   SDL_Surface *BACK_Icon;
66   SDL_Surface *INFO_Icon;
67   SDL_Surface *R_ARROW_Icon;
68   SDL_Surface *L_ARROW_Icon;
69   SDL_Surface *LOCK_Icon;
70   SDL_Surface *UNLOCK_Icon;
71 
72   SDL_Surface *Options_Icon;
73   SDL_Surface *Block;
74   SDL_Surface *UNITS_Icon;
75   SDL_Surface *MAP_Icon;
76   SDL_Surface *LOG_Icon;
77   SDL_Surface *PLAYERS_Icon;
78   SDL_Surface *UNITS2_Icon;
79   SDL_Surface *FindCity_Icon;
80   SDL_Surface *NEW_TURN_Icon;
81   SDL_Surface *SAVE_Icon;
82   SDL_Surface *LOAD_Icon;
83   SDL_Surface *DELETE_Icon;
84   SDL_Surface *BORDERS_Icon;
85 
86   /* help icons */
87   SDL_Surface *Tech_Tree_Icon;
88 
89   /* city icons */
90   SDL_Surface *Army_Icon;
91   SDL_Surface *Support_Icon;
92   SDL_Surface *Happy_Icon;
93   SDL_Surface *CMA_Icon;
94   SDL_Surface *PROD_Icon;
95   SDL_Surface *QPROD_Icon;
96   SDL_Surface *Buy_PROD_Icon;
97 
98   /* diplomacy */
99   SDL_Surface *OK_PACT_Icon;
100   SDL_Surface *CANCEL_PACT_Icon;
101 
102   /* orders icons */
103   SDL_Surface *Order_Icon;
104   SDL_Surface *ODisband_Icon;
105   SDL_Surface *OWait_Icon;
106   SDL_Surface *ODone_Icon;
107   SDL_Surface *OAutoAtt_Icon; /* currently unused */
108   SDL_Surface *OAutoExp_Icon;
109   SDL_Surface *OAutoSett_Icon;
110   SDL_Surface *OAutoConnect_Icon;
111   SDL_Surface *OUnload_Icon;
112   SDL_Surface *OBuildCity_Icon;
113   SDL_Surface *OGotoCity_Icon;
114   SDL_Surface *OGoto_Icon;
115   SDL_Surface *OHomeCity_Icon;
116   SDL_Surface *OPatrol_Icon;
117   SDL_Surface *OMine_Icon;
118   SDL_Surface *OPlantForest_Icon;
119   SDL_Surface *OCutDownForest_Icon;
120   SDL_Surface *OFortify_Icon;
121   SDL_Surface *OSentry_Icon;
122   SDL_Surface *OIrrigation_Icon;
123   SDL_Surface *ORoad_Icon;
124   SDL_Surface *ORailRoad_Icon;
125   SDL_Surface *OPillage_Icon;
126   SDL_Surface *OParaDrop_Icon;
127   SDL_Surface *ONuke_Icon;
128   SDL_Surface *OFortress_Icon;
129   SDL_Surface *OFallout_Icon;
130   SDL_Surface *OPollution_Icon;
131   SDL_Surface *OAirBase_Icon;
132   SDL_Surface *OTransform_Icon;
133   SDL_Surface *OAddCity_Icon;
134   SDL_Surface *OWonder_Icon;
135   SDL_Surface *OTrade_Icon;
136   SDL_Surface *OSpy_Icon;
137   SDL_Surface *OWakeUp_Icon;
138   SDL_Surface *OReturn_Icon;
139   SDL_Surface *OAirLift_Icon;
140   SDL_Surface *OLoad_Icon;
141 
142 };
143 
144 struct City_Icon {
145 
146   int style;
147 
148   SDL_Surface *pBIG_Food_Corr;
149   SDL_Surface *pBIG_Shield_Corr;
150   SDL_Surface *pBIG_Trade_Corr;
151   SDL_Surface *pBIG_Food;
152   SDL_Surface *pBIG_Shield;
153   SDL_Surface *pBIG_Trade;
154   SDL_Surface *pBIG_Luxury;
155   SDL_Surface *pBIG_Coin;
156   SDL_Surface *pBIG_Colb;
157   SDL_Surface *pBIG_Face;
158   SDL_Surface *pBIG_Coin_Corr;
159   SDL_Surface *pBIG_Coin_UpKeep;
160   SDL_Surface *pBIG_Shield_Surplus;
161   SDL_Surface *pBIG_Food_Surplus;
162 
163   SDL_Surface *pFood;
164   SDL_Surface *pShield;
165   SDL_Surface *pTrade;
166   SDL_Surface *pLuxury;
167   SDL_Surface *pCoin;
168   SDL_Surface *pColb;
169   SDL_Surface *pFace;
170   /*SDL_Surface *pDark_Face;*/
171 
172   SDL_Surface *pPollution;
173   SDL_Surface *pPolice;
174   SDL_Surface *pWorklist;
175 
176   /* Small Citizens */
177   SDL_Surface *pMale_Happy;
178   SDL_Surface *pFemale_Happy;
179   SDL_Surface *pMale_Content;
180   SDL_Surface *pFemale_Content;
181   SDL_Surface *pMale_Unhappy;
182   SDL_Surface *pFemale_Unhappy;
183   SDL_Surface *pMale_Angry;
184   SDL_Surface *pFemale_Angry;
185 
186   SDL_Surface *specialists[SP_MAX];
187 };
188 
189 extern struct Theme *current_theme;
190 extern struct City_Icon *pIcons;
191 
192 void tilespec_setup_theme(void);
193 void tilespec_free_theme(void);
194 
195 void tilespec_setup_city_gfx(void);
196 
197 void tilespec_setup_city_icons(void);
198 void tilespec_free_city_icons(void);
199 
200 void reload_citizens_icons(int style);
201 SDL_Surface * get_city_gfx(void);
202 
203 void draw_intro_gfx(void);
204 
205 void setup_auxiliary_tech_icons(void);
206 void free_auxiliary_tech_icons(void);
207 SDL_Surface * get_tech_icon(Tech_type_id tech);
208 SDL_Color * get_tech_color(Tech_type_id tech_id);
209 
210 /**************************************************************************
211   Return a surface for the given citizen. The citizen's type is given,
212   as well as their index (in the range [0..city_size_get(pcity))).
213 **************************************************************************/
get_citizen_surface(enum citizen_category type,int citizen_index)214 static inline SDL_Surface *get_citizen_surface(enum citizen_category type,
215                                                int citizen_index)
216 {
217   return GET_SURF(get_citizen_sprite(tileset, type, 0, NULL));
218 }
219 
220 /**************************************************************************
221   Return a surface for the flag of the given nation.
222 **************************************************************************/
get_nation_flag_surface(const struct nation_type * pnation)223 static inline SDL_Surface *get_nation_flag_surface(const struct nation_type *pnation)
224 {
225   return GET_SURF(get_nation_flag_sprite(tileset, pnation));
226 }
227 
228 /**************************************************************************
229   Return a surface for the given government icon.
230 **************************************************************************/
get_government_surface(const struct government * gov)231 static inline SDL_Surface *get_government_surface(const struct government *gov)
232 {
233   return GET_SURF(get_government_sprite(tileset, gov));
234 }
235 
236 /**************************************************************************
237   Return a sample surface of a city with the given city style
238 **************************************************************************/
get_sample_city_surface(int city_style)239 static inline SDL_Surface *get_sample_city_surface(int city_style)
240 {
241   return GET_SURF(get_sample_city_sprite(tileset, city_style));
242 }
243 
244 /**************************************************************************
245   Return a surface for the given building icon.
246 **************************************************************************/
get_building_surface(struct impr_type * pimprove)247 static inline SDL_Surface *get_building_surface(struct impr_type *pimprove)
248 {
249   return GET_SURF(get_building_sprite(tileset, pimprove));
250 }
251 
252 /**************************************************************************
253   Return a surface for the given unit type.
254 **************************************************************************/
get_unittype_surface(const struct unit_type * punittype,enum direction8 facing)255 static inline SDL_Surface *get_unittype_surface(const struct unit_type *punittype,
256                                                 enum direction8 facing)
257 {
258   return GET_SURF(get_unittype_sprite(tileset, punittype, facing, TRUE));
259 }
260 
261 /**************************************************************************
262   Return a surface for the tax icon of the given output type.
263 **************************************************************************/
get_tax_surface(Output_type_id otype)264 static inline SDL_Surface *get_tax_surface(Output_type_id otype)
265 {
266   return adj_surf(GET_SURF(get_tax_sprite(tileset, otype)));
267 }
268 
269 #endif  /* FC__GUI_TILESPEC_H */
270