annotate src/sprite.h @ 17681:ee997a9d7f63 draft

(svn r22456) -Codechange: Derive NewGRFSpriteLayout from DrawTileSprites for spritelayouts allocated on the heap, and make use of constructors and destructors.
author frosch <frosch@openttd.org>
date Sat, 14 May 2011 17:25:45 +0000
parents e17aa0669957
children 842a92695812
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
1 /* $Id$ */
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
2
12778
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 11415
diff changeset
3 /*
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 11415
diff changeset
4 * This file is part of OpenTTD.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 11415
diff changeset
5 * 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.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 11415
diff changeset
6 * 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.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 11415
diff changeset
7 * 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 <http://www.gnu.org/licenses/>.
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 11415
diff changeset
8 */
bc7926153e19 (svn r17248) -Fix: add GPL license notice where appropriate
rubidium <rubidium@openttd.org>
parents: 11415
diff changeset
9
9111
d48433370037 (svn r12971) -Documentation: add @file in files that missed them and add something more than whitespace as description of files that don't have a description.
rubidium <rubidium@openttd.org>
parents: 8571
diff changeset
10 /** @file sprite.h Base for drawing complex sprites. */
6420
080aae477331 (svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas <belugas@openttd.org>
parents: 6248
diff changeset
11
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
12 #ifndef SPRITE_H
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
13 #define SPRITE_H
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
14
14285
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
15 #include "transparency.h"
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
16
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
17 #include "table/sprites.h"
8123
c26c28875749 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium <rubidium@openttd.org>
parents: 8113
diff changeset
18
11085
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 10233
diff changeset
19 #define GENERAL_SPRITE_COLOUR(colour) ((colour) + PALETTE_RECOLOUR_START)
8da1855e9f14 (svn r15428) -Codechange: consistently use colour instead of having both color and colour.
rubidium <rubidium@openttd.org>
parents: 10233
diff changeset
20 #define COMPANY_SPRITE_COLOUR(owner) (GENERAL_SPRITE_COLOUR(_company_colours[owner]))
8113
c35412099303 (svn r11674) -Codechange: refactor some functions out of macros.h into more logical locations.
rubidium <rubidium@openttd.org>
parents: 7606
diff changeset
21
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
22 /* The following describes bunch of sprites to be drawn together in a single 3D
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
23 * bounding box. Used especially for various multi-sprite buildings (like
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
24 * depots or stations): */
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
25
10233
63a58f4b2607 (svn r14461) -Document: add some doxygen comments (Albert)
rubidium <rubidium@openttd.org>
parents: 10207
diff changeset
26 /** A tile child sprite and palette to draw for stations etc, with 3D bounding box */
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 5668
diff changeset
27 struct DrawTileSeqStruct {
10233
63a58f4b2607 (svn r14461) -Document: add some doxygen comments (Albert)
rubidium <rubidium@openttd.org>
parents: 10207
diff changeset
28 int8 delta_x; ///< \c 0x80 is sequence terminator
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
29 int8 delta_y;
17360
22a2866cab06 (svn r22106) -Codechange: Add DrawTileSeqStruct::MakeTerminator(), DrawTileSeqStruct::IsTerminator(), DrawTileSeqStruct::IsParentSprite() to simplify stuff.
frosch <frosch@openttd.org>
parents: 15969
diff changeset
30 int8 delta_z; ///< \c 0x80 identifies child sprites
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
31 byte size_x;
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
32 byte size_y;
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
33 byte size_z;
8570
2b1397dd930a (svn r12148) -Codechange: Merge 'image' and 'pal' of DrawTileSeqStruct into one PalSpriteID
frosch <frosch@openttd.org>
parents: 8123
diff changeset
34 PalSpriteID image;
17360
22a2866cab06 (svn r22106) -Codechange: Add DrawTileSeqStruct::MakeTerminator(), DrawTileSeqStruct::IsTerminator(), DrawTileSeqStruct::IsParentSprite() to simplify stuff.
frosch <frosch@openttd.org>
parents: 15969
diff changeset
35
22a2866cab06 (svn r22106) -Codechange: Add DrawTileSeqStruct::MakeTerminator(), DrawTileSeqStruct::IsTerminator(), DrawTileSeqStruct::IsParentSprite() to simplify stuff.
frosch <frosch@openttd.org>
parents: 15969
diff changeset
36 /** Make this struct a sequence terminator. */
22a2866cab06 (svn r22106) -Codechange: Add DrawTileSeqStruct::MakeTerminator(), DrawTileSeqStruct::IsTerminator(), DrawTileSeqStruct::IsParentSprite() to simplify stuff.
frosch <frosch@openttd.org>
parents: 15969
diff changeset
37 void MakeTerminator()
22a2866cab06 (svn r22106) -Codechange: Add DrawTileSeqStruct::MakeTerminator(), DrawTileSeqStruct::IsTerminator(), DrawTileSeqStruct::IsParentSprite() to simplify stuff.
frosch <frosch@openttd.org>
parents: 15969
diff changeset
38 {
22a2866cab06 (svn r22106) -Codechange: Add DrawTileSeqStruct::MakeTerminator(), DrawTileSeqStruct::IsTerminator(), DrawTileSeqStruct::IsParentSprite() to simplify stuff.
frosch <frosch@openttd.org>
parents: 15969
diff changeset
39 this->delta_x = (int8)0x80;
22a2866cab06 (svn r22106) -Codechange: Add DrawTileSeqStruct::MakeTerminator(), DrawTileSeqStruct::IsTerminator(), DrawTileSeqStruct::IsParentSprite() to simplify stuff.
frosch <frosch@openttd.org>
parents: 15969
diff changeset
40 }
22a2866cab06 (svn r22106) -Codechange: Add DrawTileSeqStruct::MakeTerminator(), DrawTileSeqStruct::IsTerminator(), DrawTileSeqStruct::IsParentSprite() to simplify stuff.
frosch <frosch@openttd.org>
parents: 15969
diff changeset
41
22a2866cab06 (svn r22106) -Codechange: Add DrawTileSeqStruct::MakeTerminator(), DrawTileSeqStruct::IsTerminator(), DrawTileSeqStruct::IsParentSprite() to simplify stuff.
frosch <frosch@openttd.org>
parents: 15969
diff changeset
42 /** Check whether this is a sequence terminator. */
22a2866cab06 (svn r22106) -Codechange: Add DrawTileSeqStruct::MakeTerminator(), DrawTileSeqStruct::IsTerminator(), DrawTileSeqStruct::IsParentSprite() to simplify stuff.
frosch <frosch@openttd.org>
parents: 15969
diff changeset
43 bool IsTerminator() const
22a2866cab06 (svn r22106) -Codechange: Add DrawTileSeqStruct::MakeTerminator(), DrawTileSeqStruct::IsTerminator(), DrawTileSeqStruct::IsParentSprite() to simplify stuff.
frosch <frosch@openttd.org>
parents: 15969
diff changeset
44 {
22a2866cab06 (svn r22106) -Codechange: Add DrawTileSeqStruct::MakeTerminator(), DrawTileSeqStruct::IsTerminator(), DrawTileSeqStruct::IsParentSprite() to simplify stuff.
frosch <frosch@openttd.org>
parents: 15969
diff changeset
45 return (byte)this->delta_x == 0x80;
22a2866cab06 (svn r22106) -Codechange: Add DrawTileSeqStruct::MakeTerminator(), DrawTileSeqStruct::IsTerminator(), DrawTileSeqStruct::IsParentSprite() to simplify stuff.
frosch <frosch@openttd.org>
parents: 15969
diff changeset
46 }
22a2866cab06 (svn r22106) -Codechange: Add DrawTileSeqStruct::MakeTerminator(), DrawTileSeqStruct::IsTerminator(), DrawTileSeqStruct::IsParentSprite() to simplify stuff.
frosch <frosch@openttd.org>
parents: 15969
diff changeset
47
22a2866cab06 (svn r22106) -Codechange: Add DrawTileSeqStruct::MakeTerminator(), DrawTileSeqStruct::IsTerminator(), DrawTileSeqStruct::IsParentSprite() to simplify stuff.
frosch <frosch@openttd.org>
parents: 15969
diff changeset
48 /** Check whether this is a parent sprite with a boundingbox. */
22a2866cab06 (svn r22106) -Codechange: Add DrawTileSeqStruct::MakeTerminator(), DrawTileSeqStruct::IsTerminator(), DrawTileSeqStruct::IsParentSprite() to simplify stuff.
frosch <frosch@openttd.org>
parents: 15969
diff changeset
49 bool IsParentSprite() const
22a2866cab06 (svn r22106) -Codechange: Add DrawTileSeqStruct::MakeTerminator(), DrawTileSeqStruct::IsTerminator(), DrawTileSeqStruct::IsParentSprite() to simplify stuff.
frosch <frosch@openttd.org>
parents: 15969
diff changeset
50 {
22a2866cab06 (svn r22106) -Codechange: Add DrawTileSeqStruct::MakeTerminator(), DrawTileSeqStruct::IsTerminator(), DrawTileSeqStruct::IsParentSprite() to simplify stuff.
frosch <frosch@openttd.org>
parents: 15969
diff changeset
51 return (byte)this->delta_z != 0x80;
22a2866cab06 (svn r22106) -Codechange: Add DrawTileSeqStruct::MakeTerminator(), DrawTileSeqStruct::IsTerminator(), DrawTileSeqStruct::IsParentSprite() to simplify stuff.
frosch <frosch@openttd.org>
parents: 15969
diff changeset
52 }
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 5668
diff changeset
53 };
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
54
17681
ee997a9d7f63 (svn r22456) -Codechange: Derive NewGRFSpriteLayout from DrawTileSprites for spritelayouts allocated on the heap, and make use of constructors and destructors.
frosch <frosch@openttd.org>
parents: 17425
diff changeset
55 /**
ee997a9d7f63 (svn r22456) -Codechange: Derive NewGRFSpriteLayout from DrawTileSprites for spritelayouts allocated on the heap, and make use of constructors and destructors.
frosch <frosch@openttd.org>
parents: 17425
diff changeset
56 * Ground palette sprite of a tile, together with its sprite layout.
ee997a9d7f63 (svn r22456) -Codechange: Derive NewGRFSpriteLayout from DrawTileSprites for spritelayouts allocated on the heap, and make use of constructors and destructors.
frosch <frosch@openttd.org>
parents: 17425
diff changeset
57 * This struct is used for static sprite layouts in the code.
ee997a9d7f63 (svn r22456) -Codechange: Derive NewGRFSpriteLayout from DrawTileSprites for spritelayouts allocated on the heap, and make use of constructors and destructors.
frosch <frosch@openttd.org>
parents: 17425
diff changeset
58 * For allocated ones from NewGRF see #NewGRFSpriteLayout.
ee997a9d7f63 (svn r22456) -Codechange: Derive NewGRFSpriteLayout from DrawTileSprites for spritelayouts allocated on the heap, and make use of constructors and destructors.
frosch <frosch@openttd.org>
parents: 17425
diff changeset
59 */
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 5668
diff changeset
60 struct DrawTileSprites {
10233
63a58f4b2607 (svn r14461) -Document: add some doxygen comments (Albert)
rubidium <rubidium@openttd.org>
parents: 10207
diff changeset
61 PalSpriteID ground; ///< Palette and sprite for the ground
63a58f4b2607 (svn r14461) -Document: add some doxygen comments (Albert)
rubidium <rubidium@openttd.org>
parents: 10207
diff changeset
62 const DrawTileSeqStruct *seq; ///< Array of child sprites. Terminated with a terminator entry
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 5668
diff changeset
63 };
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
64
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
65 /**
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
66 * This structure is the same for both Industries and Houses.
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
67 * Buildings here reference a general type of construction
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
68 */
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 5668
diff changeset
69 struct DrawBuildingsTileStruct {
5668
3d6d9bff3dd8 (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138 <peter1138@openttd.org>
parents: 5475
diff changeset
70 PalSpriteID ground;
3d6d9bff3dd8 (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138 <peter1138@openttd.org>
parents: 5475
diff changeset
71 PalSpriteID building;
7606
e490d72b2e4a (svn r11133) -Fix (r11102) [FS#1245]: in some cases vehicles would be drawn over houses when they should be drawn behind the houses. Patch by frosch.
rubidium <rubidium@openttd.org>
parents: 7318
diff changeset
72 byte subtile_x;
e490d72b2e4a (svn r11133) -Fix (r11102) [FS#1245]: in some cases vehicles would be drawn over houses when they should be drawn behind the houses. Patch by frosch.
rubidium <rubidium@openttd.org>
parents: 7318
diff changeset
73 byte subtile_y;
e490d72b2e4a (svn r11133) -Fix (r11102) [FS#1245]: in some cases vehicles would be drawn over houses when they should be drawn behind the houses. Patch by frosch.
rubidium <rubidium@openttd.org>
parents: 7318
diff changeset
74 byte width;
e490d72b2e4a (svn r11133) -Fix (r11102) [FS#1245]: in some cases vehicles would be drawn over houses when they should be drawn behind the houses. Patch by frosch.
rubidium <rubidium@openttd.org>
parents: 7318
diff changeset
75 byte height;
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
76 byte dz;
11368
82c90cd591ab (svn r15718) -Cleanup: apply some comment coding style on the rest of the sources too
rubidium <rubidium@openttd.org>
parents: 11085
diff changeset
77 byte draw_proc; // this allows to specify a special drawing procedure.
6248
0789677a15a0 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium <rubidium@openttd.org>
parents: 5668
diff changeset
78 };
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
79
6420
080aae477331 (svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas <belugas@openttd.org>
parents: 6248
diff changeset
80 /** Iterate through all DrawTileSeqStructs in DrawTileSprites. */
17360
22a2866cab06 (svn r22106) -Codechange: Add DrawTileSeqStruct::MakeTerminator(), DrawTileSeqStruct::IsTerminator(), DrawTileSeqStruct::IsParentSprite() to simplify stuff.
frosch <frosch@openttd.org>
parents: 15969
diff changeset
81 #define foreach_draw_tile_seq(idx, list) for (idx = list; !idx->IsTerminator(); idx++)
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
82
14319
72cb3c72d619 (svn r18872) -Codechange: introduce PaletteID and use it
rubidium <rubidium@openttd.org>
parents: 14294
diff changeset
83 void DrawCommonTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, int32 orig_offset, uint32 newgrf_offset, PaletteID default_palette, bool child_offset_is_unsigned);
72cb3c72d619 (svn r18872) -Codechange: introduce PaletteID and use it
rubidium <rubidium@openttd.org>
parents: 14294
diff changeset
84 void DrawCommonTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32 orig_offset, uint32 newgrf_offset, PaletteID default_palette, bool child_offset_is_unsigned);
14294
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
85
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
86 /**
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
87 * Draw tile sprite sequence on tile with railroad specifics.
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
88 * @param total_offset Spriteoffset from normal rail to current railtype.
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
89 * @param newgrf_offset Startsprite of the Action1 to use.
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
90 */
14319
72cb3c72d619 (svn r18872) -Codechange: introduce PaletteID and use it
rubidium <rubidium@openttd.org>
parents: 14294
diff changeset
91 static inline void DrawRailTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, int32 total_offset, uint32 newgrf_offset, PaletteID default_palette)
14294
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
92 {
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
93 DrawCommonTileSeq(ti, dts, to, total_offset, newgrf_offset, default_palette, false);
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
94 }
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
95
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
96 /**
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
97 * Draw tile sprite sequence in GUI with railroad specifics.
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
98 * @param total_offset Spriteoffset from normal rail to current railtype.
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
99 * @param newgrf_offset Startsprite of the Action1 to use.
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
100 */
14319
72cb3c72d619 (svn r18872) -Codechange: introduce PaletteID and use it
rubidium <rubidium@openttd.org>
parents: 14294
diff changeset
101 static inline void DrawRailTileSeqInGUI(int x, int y, const DrawTileSprites *dts, int32 total_offset, uint32 newgrf_offset, PaletteID default_palette)
14294
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
102 {
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
103 DrawCommonTileSeqInGUI(x, y, dts, total_offset, newgrf_offset, default_palette, false);
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
104 }
14285
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
105
14294
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
106 /**
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
107 * Draw TTD sprite sequence on tile.
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
108 */
14319
72cb3c72d619 (svn r18872) -Codechange: introduce PaletteID and use it
rubidium <rubidium@openttd.org>
parents: 14294
diff changeset
109 static inline void DrawOrigTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, PaletteID default_palette)
14294
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
110 {
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
111 DrawCommonTileSeq(ti, dts, to, 0, 0, default_palette, false);
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
112 }
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
113
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
114 /**
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
115 * Draw TTD sprite sequence in GUI.
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
116 */
14319
72cb3c72d619 (svn r18872) -Codechange: introduce PaletteID and use it
rubidium <rubidium@openttd.org>
parents: 14294
diff changeset
117 static inline void DrawOrigTileSeqInGUI(int x, int y, const DrawTileSprites *dts, PaletteID default_palette)
14294
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
118 {
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
119 DrawCommonTileSeqInGUI(x, y, dts, 0, 0, default_palette, false);
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
120 }
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
121
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
122 /**
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
123 * Draw NewGRF industrytile or house sprite layout
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
124 * @param stage Sprite inside the Action1 spritesets to use, i.e. construction stage.
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
125 */
14319
72cb3c72d619 (svn r18872) -Codechange: introduce PaletteID and use it
rubidium <rubidium@openttd.org>
parents: 14294
diff changeset
126 static inline void DrawNewGRFTileSeq(const struct TileInfo *ti, const DrawTileSprites *dts, TransparencyOption to, uint32 stage, PaletteID default_palette)
14294
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
127 {
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
128 DrawCommonTileSeq(ti, dts, to, 0, stage, default_palette, true);
7718a19fd027 (svn r18846) -Codechange: Merge DrawTileSeq into DrawCommonTileSeq.
frosch <frosch@openttd.org>
parents: 14290
diff changeset
129 }
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
130
14285
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
131 /**
15969
dbe7d60ea2fa (svn r20657) -Codechange: add function to draw NewGRF tileseq in the GUI
rubidium <rubidium@openttd.org>
parents: 15944
diff changeset
132 * Draw NewGRF object in GUI
dbe7d60ea2fa (svn r20657) -Codechange: add function to draw NewGRF tileseq in the GUI
rubidium <rubidium@openttd.org>
parents: 15944
diff changeset
133 * @param stage Sprite inside the Action1 spritesets to use, i.e. construction stage.
dbe7d60ea2fa (svn r20657) -Codechange: add function to draw NewGRF tileseq in the GUI
rubidium <rubidium@openttd.org>
parents: 15944
diff changeset
134 */
dbe7d60ea2fa (svn r20657) -Codechange: add function to draw NewGRF tileseq in the GUI
rubidium <rubidium@openttd.org>
parents: 15944
diff changeset
135 static inline void DrawNewGRFTileSeqInGUI(int x, int y, const DrawTileSprites *dts, uint32 stage, PaletteID default_palette)
dbe7d60ea2fa (svn r20657) -Codechange: add function to draw NewGRF tileseq in the GUI
rubidium <rubidium@openttd.org>
parents: 15944
diff changeset
136 {
dbe7d60ea2fa (svn r20657) -Codechange: add function to draw NewGRF tileseq in the GUI
rubidium <rubidium@openttd.org>
parents: 15944
diff changeset
137 DrawCommonTileSeqInGUI(x, y, dts, 0, stage, default_palette, true);
dbe7d60ea2fa (svn r20657) -Codechange: add function to draw NewGRF tileseq in the GUI
rubidium <rubidium@openttd.org>
parents: 15944
diff changeset
138 }
dbe7d60ea2fa (svn r20657) -Codechange: add function to draw NewGRF tileseq in the GUI
rubidium <rubidium@openttd.org>
parents: 15944
diff changeset
139
dbe7d60ea2fa (svn r20657) -Codechange: add function to draw NewGRF tileseq in the GUI
rubidium <rubidium@openttd.org>
parents: 15944
diff changeset
140 /**
14285
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
141 * Applies PALETTE_MODIFIER_TRANSPARENT and PALETTE_MODIFIER_COLOUR to a palette entry of a sprite layout entry
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
142 * @Note for ground sprites use #GroundSpritePaletteTransform
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
143 * @Note Not useable for OTTD internal spritelayouts from table/xxx_land.h as PALETTE_MODIFIER_TRANSPARENT is only set
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
144 * when to use the default palette.
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
145 *
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
146 * @param image The sprite to draw
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
147 * @param pal The palette from the sprite layout
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
148 * @param default_pal The default recolour sprite to use (typically company colour resp. random industry/house colour)
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
149 * @return The palette to use
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
150 */
14319
72cb3c72d619 (svn r18872) -Codechange: introduce PaletteID and use it
rubidium <rubidium@openttd.org>
parents: 14294
diff changeset
151 static inline PaletteID SpriteLayoutPaletteTransform(SpriteID image, PaletteID pal, PaletteID default_pal)
14285
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
152 {
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
153 if (HasBit(image, PALETTE_MODIFIER_TRANSPARENT) || HasBit(image, PALETTE_MODIFIER_COLOUR)) {
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
154 return (pal != 0 ? pal : default_pal);
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
155 } else {
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
156 return PAL_NONE;
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
157 }
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
158 }
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
159
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
160 /**
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
161 * Applies PALETTE_MODIFIER_COLOUR to a palette entry of a ground sprite
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
162 * @Note Not useable for OTTD internal spritelayouts from table/xxx_land.h as PALETTE_MODIFIER_TRANSPARENT is only set
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
163 * when to use the default palette.
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
164 *
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
165 * @param image The sprite to draw
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
166 * @param pal The palette from the sprite layout
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
167 * @param default_pal The default recolour sprite to use (typically company colour resp. random industry/house colour)
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
168 * @return The palette to use
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
169 */
14319
72cb3c72d619 (svn r18872) -Codechange: introduce PaletteID and use it
rubidium <rubidium@openttd.org>
parents: 14294
diff changeset
170 static inline PaletteID GroundSpritePaletteTransform(SpriteID image, PaletteID pal, PaletteID default_pal)
14285
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
171 {
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
172 if (HasBit(image, PALETTE_MODIFIER_COLOUR)) {
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
173 return (pal != 0 ? pal : default_pal);
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
174 } else {
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
175 return PAL_NONE;
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
176 }
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
177 }
53a9b675fc8f (svn r18837) -Codechange: Rename DrawStationTileSeq() to DrawCommonTileSeq() and move it to separate file.
frosch <frosch@openttd.org>
parents: 12778
diff changeset
178
5475
eabf4b86aed6 (svn r7759) -Merge: makefile rewrite. This merge features:
rubidium <rubidium@openttd.org>
parents:
diff changeset
179 #endif /* SPRITE_H */