belugas@8345: /* $Id$ */ belugas@8345: belugas@8345: /** @file transparency.h */ belugas@8345: belugas@8345: #ifndef TRANSPARENCY_H belugas@8345: #define TRANSPARENCY_H belugas@8345: rubidium@8619: #include "gfx_func.h" rubidium@8619: belugas@8345: /** belugas@8345: * Transparency option bits: which position in _transparency_opt stands for which transparency. belugas@8345: * If you change the order, change the order of the ShowTransparencyToolbar() stuff in transparency_gui.cpp too. belugas@8345: * If you add or remove an option don't forget to change the transparency 'hot keys' in main_gui.cpp. belugas@8345: * If you add an option and have more then 8, change the typedef TransparencyOptionBits and belugas@8345: * the save stuff (e.g. SLE_UINT8 to SLE_UINT16) in settings.cpp . belugas@8345: */ belugas@8345: enum TransparencyOption { belugas@8345: TO_SIGNS = 0, ///< signs belugas@8345: TO_TREES, ///< trees belugas@8345: TO_HOUSES, ///< town buildings belugas@8345: TO_INDUSTRIES, ///< industries belugas@8345: TO_BUILDINGS, ///< player buildings - depots, stations, HQ, ... belugas@8345: TO_BRIDGES, ///< bridges belugas@8345: TO_STRUCTURES, ///< unmovable structures belugas@8345: TO_LOADING, ///< loading indicators belugas@8345: TO_END, belugas@8345: }; belugas@8345: belugas@8345: typedef byte TransparencyOptionBits; ///< transparency option bits belugas@8345: extern TransparencyOptionBits _transparency_opt; belugas@8345: belugas@8345: /** belugas@8345: * Check if the transparency option bit is set belugas@8345: * and if we aren't in the game menu (there's never transparency) belugas@8345: * belugas@8345: * @param to the structure which transparency option is ask for belugas@8345: */ belugas@8345: static inline bool IsTransparencySet(TransparencyOption to) belugas@8345: { skidd13@8424: return (HasBit(_transparency_opt, to) && _game_mode != GM_MENU); belugas@8345: } belugas@8345: belugas@8345: /** belugas@8345: * Toggle the transparency option bit belugas@8345: * belugas@8345: * @param to the structure which transparency option is toggle belugas@8345: */ belugas@8345: static inline void ToggleTransparency(TransparencyOption to) belugas@8345: { skidd13@8428: ToggleBit(_transparency_opt, to); belugas@8345: } belugas@8345: belugas@8345: /** Toggle all transparency options (except signs) or restore the stored transparencies */ belugas@8345: static inline void ResetRestoreAllTransparency() belugas@8345: { belugas@8345: /* backup of the original transparencies or if all transparencies false toggle them to true */ belugas@8345: static TransparencyOptionBits trans_opt = ~0; belugas@8345: belugas@8345: if (_transparency_opt == 0) { belugas@8345: /* no structure is transparent, so restore the old transparency if present otherwise set all true */ belugas@8345: _transparency_opt = trans_opt; belugas@8345: } else { belugas@8345: /* any structure is transparent, so store current transparency settings and reset it */ belugas@8345: trans_opt = _transparency_opt; belugas@8345: _transparency_opt = 0; belugas@8345: } belugas@8345: belugas@8345: MarkWholeScreenDirty(); belugas@8345: } belugas@8345: belugas@8345: #endif /* TRANSPARENCY_H */