src/sprite.h
author rubidium
Wed, 17 Dec 2008 23:08:11 +0000
changeset 10434 3659467c844c
parent 10233 ac41e2898d9b
permissions -rw-r--r--
(svn r14687) -Change: log all configure errors to config.log
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 1883
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 1883
diff changeset
     2
9111
48ce04029fe4 (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
parents: 8571
diff changeset
     3
/** @file sprite.h Base for drawing complex sprites. */
6420
456c275f3313 (svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents: 6248
diff changeset
     4
406
34cba651d9f8 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
     5
#ifndef SPRITE_H
34cba651d9f8 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
     6
#define SPRITE_H
34cba651d9f8 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
     7
8123
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents: 8113
diff changeset
     8
#include "gfx_type.h"
ce31d2843a95 (svn r11684) -Codechange: split gfx.h in a type and functional header.
rubidium
parents: 8113
diff changeset
     9
8113
31b7784db761 (svn r11674) -Codechange: refactor some functions out of macros.h into more logical locations.
rubidium
parents: 7606
diff changeset
    10
#define GENERAL_SPRITE_COLOR(color) ((color) + PALETTE_RECOLOR_START)
10207
c291a21b304e (svn r14421) -Codechange: rename all player variables/types to company *or* client so it is immediatelly clear which one you are working with.
rubidium
parents: 10032
diff changeset
    11
#define COMPANY_SPRITE_COLOR(owner) (GENERAL_SPRITE_COLOR(_company_colours[owner]))
8113
31b7784db761 (svn r11674) -Codechange: refactor some functions out of macros.h into more logical locations.
rubidium
parents: 7606
diff changeset
    12
31b7784db761 (svn r11674) -Codechange: refactor some functions out of macros.h into more logical locations.
rubidium
parents: 7606
diff changeset
    13
/**
31b7784db761 (svn r11674) -Codechange: refactor some functions out of macros.h into more logical locations.
rubidium
parents: 7606
diff changeset
    14
 * Whether a sprite comes from the original graphics files or a new grf file
31b7784db761 (svn r11674) -Codechange: refactor some functions out of macros.h into more logical locations.
rubidium
parents: 7606
diff changeset
    15
 * (either supplied by OpenTTD or supplied by the user).
31b7784db761 (svn r11674) -Codechange: refactor some functions out of macros.h into more logical locations.
rubidium
parents: 7606
diff changeset
    16
 *
31b7784db761 (svn r11674) -Codechange: refactor some functions out of macros.h into more logical locations.
rubidium
parents: 7606
diff changeset
    17
 * @param sprite The sprite to check
31b7784db761 (svn r11674) -Codechange: refactor some functions out of macros.h into more logical locations.
rubidium
parents: 7606
diff changeset
    18
 * @return True if it is a new sprite, or false if it is original.
31b7784db761 (svn r11674) -Codechange: refactor some functions out of macros.h into more logical locations.
rubidium
parents: 7606
diff changeset
    19
 */
31b7784db761 (svn r11674) -Codechange: refactor some functions out of macros.h into more logical locations.
rubidium
parents: 7606
diff changeset
    20
#define IS_CUSTOM_SPRITE(sprite) ((sprite) >= SPR_SIGNALS_BASE)
406
34cba651d9f8 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    21
34cba651d9f8 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    22
/* The following describes bunch of sprites to be drawn together in a single 3D
34cba651d9f8 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    23
 * bounding box. Used especially for various multi-sprite buildings (like
34cba651d9f8 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    24
 * depots or stations): */
34cba651d9f8 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    25
10233
ac41e2898d9b (svn r14461) -Document: add some doxygen comments (Albert)
rubidium
parents: 10207
diff changeset
    26
/** A tile child sprite and palette to draw for stations etc, with 3D bounding box */
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5668
diff changeset
    27
struct DrawTileSeqStruct {
10233
ac41e2898d9b (svn r14461) -Document: add some doxygen comments (Albert)
rubidium
parents: 10207
diff changeset
    28
	int8 delta_x; ///< \c 0x80 is sequence terminator
406
34cba651d9f8 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    29
	int8 delta_y;
34cba651d9f8 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    30
	int8 delta_z;
4230
f4e93251e2f6 (svn r5787) Rename width, height and unk of struct DrawTileSeqStruct to size_{x,y,z}
tron
parents: 3865
diff changeset
    31
	byte size_x;
f4e93251e2f6 (svn r5787) Rename width, height and unk of struct DrawTileSeqStruct to size_{x,y,z}
tron
parents: 3865
diff changeset
    32
	byte size_y;
f4e93251e2f6 (svn r5787) Rename width, height and unk of struct DrawTileSeqStruct to size_{x,y,z}
tron
parents: 3865
diff changeset
    33
	byte size_z;
8570
f50de4804ff1 (svn r12148) -Codechange: Merge 'image' and 'pal' of DrawTileSeqStruct into one PalSpriteID
frosch
parents: 8123
diff changeset
    34
	PalSpriteID image;
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5668
diff changeset
    35
};
406
34cba651d9f8 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    36
10233
ac41e2898d9b (svn r14461) -Document: add some doxygen comments (Albert)
rubidium
parents: 10207
diff changeset
    37
/** Ground palette sprite of a tile, together with its child sprites */
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5668
diff changeset
    38
struct DrawTileSprites {
10233
ac41e2898d9b (svn r14461) -Document: add some doxygen comments (Albert)
rubidium
parents: 10207
diff changeset
    39
	PalSpriteID ground;           ///< Palette and sprite for the ground
ac41e2898d9b (svn r14461) -Document: add some doxygen comments (Albert)
rubidium
parents: 10207
diff changeset
    40
	const DrawTileSeqStruct *seq; ///< Array of child sprites. Terminated with a terminator entry
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5668
diff changeset
    41
};
406
34cba651d9f8 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    42
3654
c09872510a61 (svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents: 3595
diff changeset
    43
/**
c09872510a61 (svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents: 3595
diff changeset
    44
 * This structure is the same for both Industries and Houses.
c09872510a61 (svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents: 3595
diff changeset
    45
 * Buildings here reference a general type of construction
c09872510a61 (svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents: 3595
diff changeset
    46
 */
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5668
diff changeset
    47
struct DrawBuildingsTileStruct {
5668
36b39f4a9032 (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5475
diff changeset
    48
	PalSpriteID ground;
36b39f4a9032 (svn r8128) -Codechange: Split sprite and palette remap into separate 32 bit values.
peter1138
parents: 5475
diff changeset
    49
	PalSpriteID building;
7606
0e7c419b34e6 (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
parents: 7318
diff changeset
    50
	byte subtile_x;
0e7c419b34e6 (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
parents: 7318
diff changeset
    51
	byte subtile_y;
0e7c419b34e6 (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
parents: 7318
diff changeset
    52
	byte width;
0e7c419b34e6 (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
parents: 7318
diff changeset
    53
	byte height;
3654
c09872510a61 (svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents: 3595
diff changeset
    54
	byte dz;
c09872510a61 (svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents: 3595
diff changeset
    55
	byte draw_proc;  /* this allows to specify a special drawing procedure.*/
6248
e4a2ed7e5613 (svn r9051) -Codechange: typedef [enum|struct] Y {} X; -> [enum|struct] X {};
rubidium
parents: 5668
diff changeset
    56
};
3654
c09872510a61 (svn r4568) CodeChange : Bring definitions and uses of DrawTypesStructures toguether.
belugas
parents: 3595
diff changeset
    57
6420
456c275f3313 (svn r9556) -Documentation: doxygen and comment-style changes. 'R', 'S'.. The end of the preliminary work is near
belugas
parents: 6248
diff changeset
    58
/** Iterate through all DrawTileSeqStructs in DrawTileSprites. */
406
34cba651d9f8 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    59
#define foreach_draw_tile_seq(idx, list) for (idx = list; ((byte) idx->delta_x) != 0x80; idx++)
34cba651d9f8 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    60
10032
1f6c6f3bea28 (svn r14191) -Codechange: unify the code to skip sprite payload (i.e. not the header).
rubidium
parents: 9111
diff changeset
    61
void SkipSpriteData(byte type, uint16 num);
406
34cba651d9f8 (svn r603) -newgrf: Stupid TortoiseSVN converted the file to DOS newlines. Bah
darkvater
parents: 405
diff changeset
    62
2436
7d5df545bd5d (svn r2962) - const correctness for all Get* functions and most Draw* functions that don't change their pointer parameters
Darkvater
parents: 2242
diff changeset
    63
#endif /* SPRITE_H */