Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00012 #ifndef TRANSPARENCY_H
00013 #define TRANSPARENCY_H
00014
00015 #include "gfx_func.h"
00016 #include "openttd.h"
00017 #include "core/bitmath_func.hpp"
00018
00024 enum TransparencyOption {
00025 TO_SIGNS = 0,
00026 TO_TREES,
00027 TO_HOUSES,
00028 TO_INDUSTRIES,
00029 TO_BUILDINGS,
00030 TO_BRIDGES,
00031 TO_STRUCTURES,
00032 TO_CATENARY,
00033 TO_LOADING,
00034 TO_TUNNELS,
00035 TO_END,
00036 TO_INVALID,
00037 };
00038
00039 typedef uint TransparencyOptionBits;
00040 extern TransparencyOptionBits _transparency_opt;
00041 extern TransparencyOptionBits _transparency_lock;
00042 extern TransparencyOptionBits _invisibility_opt;
00043 extern byte _display_opt;
00044
00051 static inline bool IsTransparencySet(TransparencyOption to)
00052 {
00053 return (HasBit(_transparency_opt, to) && _game_mode != GM_MENU);
00054 }
00055
00062 static inline bool IsInvisibilitySet(TransparencyOption to)
00063 {
00064 return (HasBit(_transparency_opt & _invisibility_opt, to) && _game_mode != GM_MENU);
00065 }
00066
00072 static inline void ToggleTransparency(TransparencyOption to)
00073 {
00074 ToggleBit(_transparency_opt, to);
00075 }
00076
00082 static inline void ToggleInvisibility(TransparencyOption to)
00083 {
00084 ToggleBit(_invisibility_opt, to);
00085 }
00086
00094 static inline void ToggleInvisibilityWithTransparency(TransparencyOption to)
00095 {
00096 if (IsInvisibilitySet(to)) {
00097 ClrBit(_invisibility_opt, to);
00098 ClrBit(_transparency_opt, to);
00099 } else {
00100 SetBit(_invisibility_opt, to);
00101 SetBit(_transparency_opt, to);
00102 }
00103 }
00104
00110 static inline void ToggleTransparencyLock(TransparencyOption to)
00111 {
00112 ToggleBit(_transparency_lock, to);
00113 }
00114
00116 static inline void ResetRestoreAllTransparency()
00117 {
00118
00119 if ((_transparency_opt & ~_transparency_lock) == 0) {
00120
00121 _transparency_opt |= GB(~_transparency_lock, 0, TO_END);
00122 } else {
00123
00124 _transparency_opt &= _transparency_lock;
00125 }
00126
00127 MarkWholeScreenDirty();
00128 }
00129
00130 #endif