OpenTTD Source: src/table/water_land.h Source File

OpenTTD Source 15.3

water_land.h
Go to the documentation of this file.
1/*
2 * This file is part of OpenTTD.
3 * OpenTTD is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, version 2.
4 * OpenTTD is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 * See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with OpenTTD. If not, see <https://www.gnu.org/licenses/old-licenses/gpl-2.0>.
6 */
7
20#define TILE_SEQ_LINE(dx, dy, dz, sx, sy, sz, img) { dx, dy, dz, sx, sy, sz, {img, PAL_NONE} },
21
27#define TILE_SPRITE_LINE(img, dtss) { {img, PAL_NONE}, dtss },
28
29static const DrawTileSeqStruct _shipdepot_display_ne_seq[] = {
30 TILE_SEQ_LINE( 0, 15, 0, 16, 1, 0x14, 0xFE8 | (1 << PALETTE_MODIFIER_COLOUR))
31};
32
33static const DrawTileSeqStruct _shipdepot_display_sw_seq[] = {
34 TILE_SEQ_LINE( 0, 0, 0, 16, 1, 0x14, 0xFEA)
35 TILE_SEQ_LINE( 0, 15, 0, 16, 1, 0x14, 0xFE6 | (1 << PALETTE_MODIFIER_COLOUR))
36};
37
38static const DrawTileSeqStruct _shipdepot_display_nw_seq[] = {
39 TILE_SEQ_LINE( 15, 0, 0, 1, 0x10, 0x14, 0xFE9 | (1 << PALETTE_MODIFIER_COLOUR))
40};
41
42static const DrawTileSeqStruct _shipdepot_display_se_seq[] = {
43 TILE_SEQ_LINE( 0, 0, 0, 1, 16, 0x14, 0xFEB)
44 TILE_SEQ_LINE( 15, 0, 0, 1, 16, 0x14, 0xFE7 | (1 << PALETTE_MODIFIER_COLOUR))
45};
46
47static const DrawTileSpriteSpan _shipdepot_display_data[][to_underlying(DepotPart::End)] = {
48 { // AXIS_X
49 TILE_SPRITE_LINE(0xFDD, _shipdepot_display_ne_seq) // DepotPart::North
50 TILE_SPRITE_LINE(0xFDD, _shipdepot_display_sw_seq) // DepotPart::South
51 },
52 { // AXIS_Y
53 TILE_SPRITE_LINE(0xFDD, _shipdepot_display_nw_seq) // DepotPart::North
54 TILE_SPRITE_LINE(0xFDD, _shipdepot_display_se_seq) // DepotPart::South
55 },
56};
57
58 static constexpr uint8_t LOCK_HEIGHT_LOWER_REAR = 6;
59 static constexpr uint8_t LOCK_HEIGHT_LOWER_FRONT = 10;
60 static constexpr uint8_t LOCK_HEIGHT_MIDDLE_REAR = 6;
61 static constexpr uint8_t LOCK_HEIGHT_MIDDLE_FRONT = 10;
62 static constexpr uint8_t LOCK_HEIGHT_UPPER_REAR = 6;
63 static constexpr uint8_t LOCK_HEIGHT_UPPER_FRONT = 6;
64
65static const DrawTileSeqStruct _lock_display_middle_ne_seq[] = {
66 TILE_SEQ_LINE(0, 0, 0, TILE_SIZE, 1, LOCK_HEIGHT_MIDDLE_REAR, 0 + 1)
67 TILE_SEQ_LINE(0, 15, 0, TILE_SIZE, 1, LOCK_HEIGHT_MIDDLE_FRONT, 4 + 1)
68};
69
70static const DrawTileSeqStruct _lock_display_middle_se_seq[] = {
71 TILE_SEQ_LINE( 0, 0, 0, 1, TILE_SIZE, LOCK_HEIGHT_MIDDLE_REAR, 0)
72 TILE_SEQ_LINE(15, 0, 0, 1, TILE_SIZE, LOCK_HEIGHT_MIDDLE_FRONT, 4)
73};
74
75static const DrawTileSeqStruct _lock_display_middle_sw_seq[] = {
76 TILE_SEQ_LINE(0, 0, 0, TILE_SIZE, 1, LOCK_HEIGHT_MIDDLE_REAR, 0 + 2)
77 TILE_SEQ_LINE(0, 15, 0, TILE_SIZE, 1, LOCK_HEIGHT_MIDDLE_FRONT, 4 + 2)
78};
79
80static const DrawTileSeqStruct _lock_display_middle_nw_seq[] = {
81 TILE_SEQ_LINE( 0, 0, 0, 1, TILE_SIZE, LOCK_HEIGHT_MIDDLE_REAR, 0 + 3)
82 TILE_SEQ_LINE(15, 0, 0, 1, TILE_SIZE, LOCK_HEIGHT_MIDDLE_FRONT, 4 + 3)
83};
84
85static const DrawTileSeqStruct _lock_display_lower_ne_seq[] = {
86 TILE_SEQ_LINE(0, 0, 0, TILE_SIZE, 1, LOCK_HEIGHT_LOWER_REAR, 8 + 1)
87 TILE_SEQ_LINE(0, 15, 0, TILE_SIZE, 1, LOCK_HEIGHT_LOWER_FRONT, 12 + 1)
88};
89
90static const DrawTileSeqStruct _lock_display_lower_se_seq[] = {
91 TILE_SEQ_LINE( 0, 0, 0, 1, TILE_SIZE, LOCK_HEIGHT_LOWER_REAR, 8)
92 TILE_SEQ_LINE(15, 0, 0, 1, TILE_SIZE, LOCK_HEIGHT_LOWER_FRONT, 12)
93};
94
95static const DrawTileSeqStruct _lock_display_lower_sw_seq[] = {
96 TILE_SEQ_LINE(0, 0, 0, TILE_SIZE, 1, LOCK_HEIGHT_LOWER_REAR, 8 + 2)
97 TILE_SEQ_LINE(0, 15, 0, TILE_SIZE, 1, LOCK_HEIGHT_LOWER_FRONT, 12 + 2)
98};
99
100static const DrawTileSeqStruct _lock_display_lower_nw_seq[] = {
101 TILE_SEQ_LINE( 0, 0, 0, 1, TILE_SIZE, LOCK_HEIGHT_LOWER_REAR, 8 + 3)
102 TILE_SEQ_LINE(15, 0, 0, 1, TILE_SIZE, LOCK_HEIGHT_LOWER_FRONT, 12 + 3)
103};
104
105static const DrawTileSeqStruct _lock_display_upper_ne_seq[] = {
106 TILE_SEQ_LINE(0, 0, 0, TILE_SIZE, 1, LOCK_HEIGHT_UPPER_REAR, 16 + 1)
107 TILE_SEQ_LINE(0, 15, 0, TILE_SIZE, 1, LOCK_HEIGHT_UPPER_FRONT, 20 + 1)
108};
109
110static const DrawTileSeqStruct _lock_display_upper_se_seq[] = {
111 TILE_SEQ_LINE( 0, 0, 0, 1, TILE_SIZE, LOCK_HEIGHT_UPPER_REAR, 16)
112 TILE_SEQ_LINE(15, 0, 0, 1, TILE_SIZE, LOCK_HEIGHT_UPPER_FRONT, 20)
113};
114
115static const DrawTileSeqStruct _lock_display_upper_sw_seq[] = {
116 TILE_SEQ_LINE(0, 0, 0, TILE_SIZE, 1, LOCK_HEIGHT_UPPER_REAR, 16 + 2)
117 TILE_SEQ_LINE(0, 15, 0, TILE_SIZE, 1, LOCK_HEIGHT_UPPER_FRONT, 20 + 2)
118};
119
120static const DrawTileSeqStruct _lock_display_upper_nw_seq[] = {
121 TILE_SEQ_LINE( 0, 0, 0, 1, TILE_SIZE, LOCK_HEIGHT_UPPER_REAR, 16 + 3)
122 TILE_SEQ_LINE(15, 0, 0, 1, TILE_SIZE, LOCK_HEIGHT_UPPER_FRONT, 20 + 3)
123};
124
125static const DrawTileSpriteSpan _lock_display_data[][DIAGDIR_END] = {
126 { // LockPart::Middle
127 TILE_SPRITE_LINE(1, _lock_display_middle_ne_seq) // NE
128 TILE_SPRITE_LINE(0, _lock_display_middle_se_seq) // SE
129 TILE_SPRITE_LINE(2, _lock_display_middle_sw_seq) // SW
130 TILE_SPRITE_LINE(3, _lock_display_middle_nw_seq) // NW
131 },
132
133 { // LockPart::Lower
134 TILE_SPRITE_LINE(0xFDD, _lock_display_lower_ne_seq) // NE
135 TILE_SPRITE_LINE(0xFDD, _lock_display_lower_se_seq) // SE
136 TILE_SPRITE_LINE(0xFDD, _lock_display_lower_sw_seq) // SW
137 TILE_SPRITE_LINE(0xFDD, _lock_display_lower_nw_seq) // NW
138 },
139
140 { // LockPart::Upper
141 TILE_SPRITE_LINE(0xFDD, _lock_display_upper_ne_seq) // NE
142 TILE_SPRITE_LINE(0xFDD, _lock_display_upper_se_seq) // SE
143 TILE_SPRITE_LINE(0xFDD, _lock_display_upper_sw_seq) // SW
144 TILE_SPRITE_LINE(0xFDD, _lock_display_upper_nw_seq) // NW
145 },
146};
147
148#undef TILE_SEQ_LINE
149#undef TILE_SPRITE_LINE
CommandType::End
@ End
End marker.
DIAGDIR_END
@ DIAGDIR_END
Used for iterations.
Definition direction_type.h:84
to_underlying
constexpr std::underlying_type_t< enum_type > to_underlying(enum_type e)
Implementation of std::to_underlying (from C++23)
Definition enum_type.hpp:17
PALETTE_MODIFIER_COLOUR
static constexpr uint8_t PALETTE_MODIFIER_COLOUR
this bit is set when a recolouring process is in action
Definition sprites.h:1562
DrawTileSeqStruct
A tile child sprite and palette to draw for stations etc, with 3D bounding box.
Definition sprite.h:33
DrawTileSpriteSpan
Ground palette sprite of a tile, together with its sprite layout.
Definition sprite.h:67
TILE_SIZE
static constexpr uint TILE_SIZE
Tile size in world coordinates.
Definition tile_type.h:15
TILE_SPRITE_LINE
#define TILE_SPRITE_LINE(img, dtss)
Constructor macro of a DrawTileSpriteSpan structure.
Definition water_land.h:27
LOCK_HEIGHT_UPPER_FRONT
static constexpr uint8_t LOCK_HEIGHT_UPPER_FRONT
Sub-tile height of front wall of upper part.
Definition water_land.h:63
TILE_SEQ_LINE
#define TILE_SEQ_LINE(dx, dy, dz, sx, sy, sz, img)
Constructor macro for an image without a palette in a DrawTileSeqStruct array.
Definition water_land.h:20
LOCK_HEIGHT_LOWER_FRONT
static constexpr uint8_t LOCK_HEIGHT_LOWER_FRONT
Sub-tile height of front wall of lower part.
Definition water_land.h:59
LOCK_HEIGHT_MIDDLE_REAR
static constexpr uint8_t LOCK_HEIGHT_MIDDLE_REAR
Sub-tile height of rear wall of middle part.
Definition water_land.h:60
LOCK_HEIGHT_LOWER_REAR
static constexpr uint8_t LOCK_HEIGHT_LOWER_REAR
Sub-tile height of rear wall of lower part.
Definition water_land.h:58
LOCK_HEIGHT_UPPER_REAR
static constexpr uint8_t LOCK_HEIGHT_UPPER_REAR
Sub-tile height of rear wall of upper part.
Definition water_land.h:62
LOCK_HEIGHT_MIDDLE_FRONT
static constexpr uint8_t LOCK_HEIGHT_MIDDLE_FRONT
Sub-tile height of front wall of middle part.
Definition water_land.h:61
DepotPart
DepotPart
Sections of the water depot.
Definition water_map.h:58