OpenTTD Source 20260604-master-ga892d8e848
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
9
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
49 {{{ // Axis::X
50 TILE_SPRITE_LINE(0xFDD, _shipdepot_display_ne_seq) // DepotPart::North
51 TILE_SPRITE_LINE(0xFDD, _shipdepot_display_sw_seq) // DepotPart::South
52 }}},
53 {{{ // Axis::Y
54 TILE_SPRITE_LINE(0xFDD, _shipdepot_display_nw_seq) // DepotPart::North
55 TILE_SPRITE_LINE(0xFDD, _shipdepot_display_se_seq) // DepotPart::South
56 }}},
57}}};
58
59static constexpr uint8_t LOCK_HEIGHT_LOWER_REAR = 6;
60static constexpr uint8_t LOCK_HEIGHT_LOWER_FRONT = 10;
61static constexpr uint8_t LOCK_HEIGHT_MIDDLE_REAR = 6;
62static constexpr uint8_t LOCK_HEIGHT_MIDDLE_FRONT = 10;
63static constexpr uint8_t LOCK_HEIGHT_UPPER_REAR = 6;
64static constexpr uint8_t LOCK_HEIGHT_UPPER_FRONT = 6;
65
66static const DrawTileSeqStruct _lock_display_middle_ne_seq[] = {
69};
70
71static const DrawTileSeqStruct _lock_display_middle_se_seq[] = {
73 TILE_SEQ_LINE(15, 0, 0, 1, TILE_SIZE, LOCK_HEIGHT_MIDDLE_FRONT, 4)
74};
75
76static const DrawTileSeqStruct _lock_display_middle_sw_seq[] = {
78 TILE_SEQ_LINE(0, 15, 0, TILE_SIZE, 1, LOCK_HEIGHT_MIDDLE_FRONT, 4 + 2)
79};
80
81static const DrawTileSeqStruct _lock_display_middle_nw_seq[] = {
83 TILE_SEQ_LINE(15, 0, 0, 1, TILE_SIZE, LOCK_HEIGHT_MIDDLE_FRONT, 4 + 3)
84};
85
86static const DrawTileSeqStruct _lock_display_lower_ne_seq[] = {
88 TILE_SEQ_LINE(0, 15, 0, TILE_SIZE, 1, LOCK_HEIGHT_LOWER_FRONT, 12 + 1)
89};
90
91static const DrawTileSeqStruct _lock_display_lower_se_seq[] = {
93 TILE_SEQ_LINE(15, 0, 0, 1, TILE_SIZE, LOCK_HEIGHT_LOWER_FRONT, 12)
94};
95
96static const DrawTileSeqStruct _lock_display_lower_sw_seq[] = {
98 TILE_SEQ_LINE(0, 15, 0, TILE_SIZE, 1, LOCK_HEIGHT_LOWER_FRONT, 12 + 2)
99};
100
101static const DrawTileSeqStruct _lock_display_lower_nw_seq[] = {
103 TILE_SEQ_LINE(15, 0, 0, 1, TILE_SIZE, LOCK_HEIGHT_LOWER_FRONT, 12 + 3)
104};
105
106static const DrawTileSeqStruct _lock_display_upper_ne_seq[] = {
108 TILE_SEQ_LINE(0, 15, 0, TILE_SIZE, 1, LOCK_HEIGHT_UPPER_FRONT, 20 + 1)
109};
110
111static const DrawTileSeqStruct _lock_display_upper_se_seq[] = {
113 TILE_SEQ_LINE(15, 0, 0, 1, TILE_SIZE, LOCK_HEIGHT_UPPER_FRONT, 20)
114};
115
116static const DrawTileSeqStruct _lock_display_upper_sw_seq[] = {
118 TILE_SEQ_LINE(0, 15, 0, TILE_SIZE, 1, LOCK_HEIGHT_UPPER_FRONT, 20 + 2)
119};
120
121static const DrawTileSeqStruct _lock_display_upper_nw_seq[] = {
122 TILE_SEQ_LINE( 0, 0, 0, 1, TILE_SIZE, LOCK_HEIGHT_UPPER_REAR, 16 + 3)
123 TILE_SEQ_LINE(15, 0, 0, 1, TILE_SIZE, LOCK_HEIGHT_UPPER_FRONT, 20 + 3)
124};
125
128 {{{ // LockPart::Middle
129 TILE_SPRITE_LINE(1, _lock_display_middle_ne_seq) // NE
130 TILE_SPRITE_LINE(0, _lock_display_middle_se_seq) // SE
131 TILE_SPRITE_LINE(2, _lock_display_middle_sw_seq) // SW
132 TILE_SPRITE_LINE(3, _lock_display_middle_nw_seq) // NW
133 }}},
134 {{{ // LockPart::Lower
135 TILE_SPRITE_LINE(0xFDD, _lock_display_lower_ne_seq) // NE
136 TILE_SPRITE_LINE(0xFDD, _lock_display_lower_se_seq) // SE
137 TILE_SPRITE_LINE(0xFDD, _lock_display_lower_sw_seq) // SW
138 TILE_SPRITE_LINE(0xFDD, _lock_display_lower_nw_seq) // NW
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
EnumIndexArray< T, Axis, Axis::End > AxisIndexArray
Array with Axis as index.
EnumIndexArray< T, DiagDirection, DiagDirection::End > DiagDirectionIndexArray
Array with DiagDirection as index.
EnumClassIndexContainer< std::array< T, to_underlying(N)>, Index > EnumIndexArray
A typedef for EnumClassIndexContainer using std::array as the backing container type.
static constexpr uint8_t PALETTE_MODIFIER_COLOUR
this bit is set when a recolouring process is in action
Definition sprites.h:1562
A tile child sprite and palette to draw for stations etc, with 3D bounding box.
Definition sprite.h:33
Ground palette sprite of a tile, together with its sprite layout.
Definition sprite.h:76
static constexpr uint TILE_SIZE
Tile size in world coordinates.
Definition tile_type.h:15
@ End
End marker.
Definition vehicle.cpp:2829
static const AxisIndexArray< EnumIndexArray< DrawTileSpriteSpan, DepotPart, DepotPart::End > > _shipdepot_display_data
Data for drawing ship depots by Axis and DepotPart.
Definition water_land.h:48
#define TILE_SPRITE_LINE(img, dtss)
Constructor macro of a DrawTileSpriteSpan structure.
Definition water_land.h:27
static constexpr uint8_t LOCK_HEIGHT_UPPER_FRONT
Sub-tile height of front wall of upper part.
Definition water_land.h:64
#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
static constexpr uint8_t LOCK_HEIGHT_LOWER_FRONT
Sub-tile height of front wall of lower part.
Definition water_land.h:60
static const EnumIndexArray< DiagDirectionIndexArray< DrawTileSpriteSpan >, LockPart, LockPart::End > _lock_display_data
Sprite layout of a lock for each lock part and direction.
Definition water_land.h:127
static constexpr uint8_t LOCK_HEIGHT_MIDDLE_REAR
Sub-tile height of rear wall of middle part.
Definition water_land.h:61
static constexpr uint8_t LOCK_HEIGHT_LOWER_REAR
Sub-tile height of rear wall of lower part.
Definition water_land.h:59
static constexpr uint8_t LOCK_HEIGHT_UPPER_REAR
Sub-tile height of rear wall of upper part.
Definition water_land.h:63
static constexpr uint8_t LOCK_HEIGHT_MIDDLE_FRONT
Sub-tile height of front wall of middle part.
Definition water_land.h:62
DepotPart
Sections of the water depot.
Definition water_map.h:58
LockPart
Sections of the water lock.
Definition water_map.h:65