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_END,
00035 };
00036
00037 typedef uint TransparencyOptionBits;
00038 extern TransparencyOptionBits _transparency_opt;
00039 extern TransparencyOptionBits _transparency_lock;
00040 extern TransparencyOptionBits _invisibility_opt;
00041 extern byte _display_opt;
00042
00049 static inline bool IsTransparencySet(TransparencyOption to)
00050 {
00051 return (HasBit(_transparency_opt, to) && _game_mode != GM_MENU);
00052 }
00053
00060 static inline bool IsInvisibilitySet(TransparencyOption to)
00061 {
00062 return (HasBit(_transparency_opt & _invisibility_opt, to) && _game_mode != GM_MENU);
00063 }
00064
00070 static inline void ToggleTransparency(TransparencyOption to)
00071 {
00072 ToggleBit(_transparency_opt, to);
00073 }
00074
00080 static inline void ToggleInvisibility(TransparencyOption to)
00081 {
00082 ToggleBit(_invisibility_opt, to);
00083 }
00084
00092 static inline void ToggleInvisibilityWithTransparency(TransparencyOption to)
00093 {
00094 if (IsInvisibilitySet(to)) {
00095 ClrBit(_invisibility_opt, to);
00096 ClrBit(_transparency_opt, to);
00097 } else {
00098 SetBit(_invisibility_opt, to);
00099 SetBit(_transparency_opt, to);
00100 }
00101 }
00102
00108 static inline void ToggleTransparencyLock(TransparencyOption to)
00109 {
00110 ToggleBit(_transparency_lock, to);
00111 }
00112
00114 static inline void ResetRestoreAllTransparency()
00115 {
00116
00117 if ((_transparency_opt & ~_transparency_lock) == 0) {
00118
00119 _transparency_opt |= GB(~_transparency_lock, 0, TO_END);
00120 } else {
00121
00122 _transparency_opt &= _transparency_lock;
00123 }
00124
00125 MarkWholeScreenDirty();
00126 }
00127
00128 #endif