author | smatz |
Sun, 10 Feb 2008 18:31:33 +0000 | |
changeset 8529 | 93d4dea423e5 |
parent 8528 | 6e61e651790e |
child 8658 | e6fd51e0e9b0 |
permissions | -rw-r--r-- |
7849
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
1 |
/* $Id$ */ |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
2 |
|
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
3 |
/** @file transparency.h */ |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
4 |
|
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
5 |
#ifndef TRANSPARENCY_H |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
6 |
#define TRANSPARENCY_H |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
7 |
|
8123
ce31d2843a95
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
7932
diff
changeset
|
8 |
#include "gfx_func.h" |
ce31d2843a95
(svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents:
7932
diff
changeset
|
9 |
|
7849
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
10 |
/** |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
11 |
* Transparency option bits: which position in _transparency_opt stands for which transparency. |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
12 |
* If you change the order, change the order of the ShowTransparencyToolbar() stuff in transparency_gui.cpp too. |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
13 |
* If you add or remove an option don't forget to change the transparency 'hot keys' in main_gui.cpp. |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
14 |
*/ |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
15 |
enum TransparencyOption { |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
16 |
TO_SIGNS = 0, ///< signs |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
17 |
TO_TREES, ///< trees |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
18 |
TO_HOUSES, ///< town buildings |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
19 |
TO_INDUSTRIES, ///< industries |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
20 |
TO_BUILDINGS, ///< player buildings - depots, stations, HQ, ... |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
21 |
TO_BRIDGES, ///< bridges |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
22 |
TO_STRUCTURES, ///< unmovable structures |
8528
6e61e651790e
(svn r12103) -Feature(tte): separate catenary transparency settings from building transparency settings
smatz
parents:
8527
diff
changeset
|
23 |
TO_CATENARY, ///< catenary |
7849
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
24 |
TO_LOADING, ///< loading indicators |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
25 |
TO_END, |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
26 |
}; |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
27 |
|
8528
6e61e651790e
(svn r12103) -Feature(tte): separate catenary transparency settings from building transparency settings
smatz
parents:
8527
diff
changeset
|
28 |
typedef uint TransparencyOptionBits; ///< transparency option bits |
7849
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
29 |
extern TransparencyOptionBits _transparency_opt; |
8527
a32b9ac056af
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
maedhros
parents:
8123
diff
changeset
|
30 |
extern TransparencyOptionBits _transparency_lock; |
7849
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
31 |
|
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
32 |
/** |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
33 |
* Check if the transparency option bit is set |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
34 |
* and if we aren't in the game menu (there's never transparency) |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
35 |
* |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
36 |
* @param to the structure which transparency option is ask for |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
37 |
*/ |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
38 |
static inline bool IsTransparencySet(TransparencyOption to) |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
39 |
{ |
7928
63e18de69e50
(svn r11481) -Codechange: Rename the HASBIT function to fit with the naming style
skidd13
parents:
7849
diff
changeset
|
40 |
return (HasBit(_transparency_opt, to) && _game_mode != GM_MENU); |
7849
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
41 |
} |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
42 |
|
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
43 |
/** |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
44 |
* Toggle the transparency option bit |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
45 |
* |
8527
a32b9ac056af
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
maedhros
parents:
8123
diff
changeset
|
46 |
* @param to the transparency option to be toggled |
7849
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
47 |
*/ |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
48 |
static inline void ToggleTransparency(TransparencyOption to) |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
49 |
{ |
7932
6c3d71e8a129
(svn r11485) -Codechange: Remove the doubled function ToggleBitT and rename the remaining to fit with the naming style
skidd13
parents:
7928
diff
changeset
|
50 |
ToggleBit(_transparency_opt, to); |
7849
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
51 |
} |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
52 |
|
8527
a32b9ac056af
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
maedhros
parents:
8123
diff
changeset
|
53 |
/** |
a32b9ac056af
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
maedhros
parents:
8123
diff
changeset
|
54 |
* Toggle the transparency lock bit |
a32b9ac056af
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
maedhros
parents:
8123
diff
changeset
|
55 |
* |
a32b9ac056af
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
maedhros
parents:
8123
diff
changeset
|
56 |
* @param to the transparency option to be locked or unlocked |
a32b9ac056af
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
maedhros
parents:
8123
diff
changeset
|
57 |
*/ |
a32b9ac056af
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
maedhros
parents:
8123
diff
changeset
|
58 |
static inline void ToggleTransparencyLock(TransparencyOption to) |
a32b9ac056af
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
maedhros
parents:
8123
diff
changeset
|
59 |
{ |
a32b9ac056af
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
maedhros
parents:
8123
diff
changeset
|
60 |
ToggleBit(_transparency_lock, to); |
a32b9ac056af
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
maedhros
parents:
8123
diff
changeset
|
61 |
} |
a32b9ac056af
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
maedhros
parents:
8123
diff
changeset
|
62 |
|
a32b9ac056af
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
maedhros
parents:
8123
diff
changeset
|
63 |
/** Set or clear all non-locked transparency options */ |
7849
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
64 |
static inline void ResetRestoreAllTransparency() |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
65 |
{ |
8527
a32b9ac056af
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
maedhros
parents:
8123
diff
changeset
|
66 |
/* if none of the non-locked options are set */ |
a32b9ac056af
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
maedhros
parents:
8123
diff
changeset
|
67 |
if ((_transparency_opt & ~_transparency_lock) == 0) { |
a32b9ac056af
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
maedhros
parents:
8123
diff
changeset
|
68 |
/* set all non-locked options */ |
a32b9ac056af
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
maedhros
parents:
8123
diff
changeset
|
69 |
_transparency_opt |= ~_transparency_lock; |
7849
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
70 |
} else { |
8527
a32b9ac056af
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
maedhros
parents:
8123
diff
changeset
|
71 |
/* clear all non-locked options */ |
a32b9ac056af
(svn r12102) -Feature: Allow locking individual transparency settings so they will not be changed by pressing 'x'. (Roujin)
maedhros
parents:
8123
diff
changeset
|
72 |
_transparency_opt &= _transparency_lock; |
7849
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
73 |
} |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
74 |
|
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
75 |
MarkWholeScreenDirty(); |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
76 |
} |
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
77 |
|
0a1c0af2c96c
(svn r11399) -Feature(ette): transparency settings can now be saved and thus remembered.
belugas
parents:
diff
changeset
|
78 |
#endif /* TRANSPARENCY_H */ |