Changeset - r14280:9e2593121da6
[Not reviewed]
master
0 9 0
frosch - 14 years ago 2010-01-17 01:01:56
frosch@openttd.org
(svn r18842) -Codechange: Rename SPRITE_MODIFIER_USE_OFFSET to SPRITE_MODIFIER_CUSTOM_SPRITE, invert its meaning, and also use it for industry/house layouts instead of IS_CUSTOM_SPRITE().
9 files changed with 20 insertions and 23 deletions:
0 comments (0 inline, 0 general)
src/newgrf.cpp
Show inline comments
 
@@ -1139,8 +1139,9 @@ static ChangeInfoResult StationChangeInf
 
					dts->ground.pal = grf_load_word(&buf);
 
					if (dts->ground.sprite == 0) continue;
 
					if (HasBit(dts->ground.pal, 15)) {
 
						/* Use sprite from Action 1 */
 
						ClrBit(dts->ground.pal, 15);
 
						SetBit(dts->ground.sprite, SPRITE_MODIFIER_USE_OFFSET);
 
						SetBit(dts->ground.sprite, SPRITE_MODIFIER_CUSTOM_SPRITE);
 
					}
 

	
 
					MapSpriteMappingRecolour(&dts->ground);
 
@@ -1160,10 +1161,11 @@ static ChangeInfoResult StationChangeInf
 
						dtss->image.sprite = grf_load_word(&buf);
 
						dtss->image.pal = grf_load_word(&buf);
 

	
 
						/* Remap flags as ours collide */
 
						if (HasBit(dtss->image.pal, 15)) {
 
							ClrBit(dtss->image.pal, 15);
 
							SetBit(dtss->image.sprite, SPRITE_MODIFIER_USE_OFFSET);
 
						} else {
 
							/* Use sprite from Action 1 (yes, this is inverse to above) */
 
							SetBit(dtss->image.sprite, SPRITE_MODIFIER_CUSTOM_SPRITE);
 
						}
 

	
 
						MapSpriteMappingRecolour(&dtss->image);
 
@@ -2937,6 +2939,7 @@ static void NewSpriteGroup(byte *buf, si
 
							SpriteID sprite = _cur_grffile->spriteset_start + spriteset * num_spriteset_ents;
 
							SB(group->dts->ground.sprite, 0, SPRITE_WIDTH, sprite);
 
							ClrBit(group->dts->ground.pal, 15);
 
							SetBit(group->dts->ground.sprite, SPRITE_MODIFIER_CUSTOM_SPRITE);
 
						}
 
					}
 

	
 
@@ -2964,6 +2967,7 @@ static void NewSpriteGroup(byte *buf, si
 
								SpriteID sprite = _cur_grffile->spriteset_start + spriteset * num_spriteset_ents;
 
								SB(seq->image.sprite, 0, SPRITE_WIDTH, sprite);
 
								ClrBit(seq->image.pal, 15);
 
								SetBit(seq->image.sprite, SPRITE_MODIFIER_CUSTOM_SPRITE);
 
							}
 
						}
 

	
src/newgrf_commons.cpp
Show inline comments
 
@@ -339,14 +339,15 @@ void DrawTileSeq(const TileInfo *ti, con
 
		if (GB(dtss->image.sprite, 0, SPRITE_WIDTH) == 0) continue;
 

	
 
		SpriteID image = dtss->image.sprite;
 
		SpriteID pal   = dtss->image.pal;
 

	
 
		/* Stop drawing sprite sequence once we meet a sprite that doesn't have to be opaque */
 
		if (IsInvisibilitySet(to) && !HasBit(image, SPRITE_MODIFIER_OPAQUE)) return;
 

	
 
		if (IS_CUSTOM_SPRITE(image)) image += stage;
 
		if (HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE)) {
 
			image += stage;
 
		}
 

	
 
		pal = SpriteLayoutPaletteTransform(image, pal, default_palette);
 
		SpriteID pal = SpriteLayoutPaletteTransform(image, dtss->image.pal, default_palette);
 

	
 
		if ((byte)dtss->delta_z != 0x80) {
 
			AddSortableSpriteToDraw(
src/newgrf_house.cpp
Show inline comments
 
@@ -415,7 +415,7 @@ static void DrawTileLayout(const TileInf
 
	SpriteID image = dts->ground.sprite;
 
	SpriteID pal   = dts->ground.pal;
 

	
 
	if (IS_CUSTOM_SPRITE(image)) image += stage;
 
	if (HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE)) image += stage;
 

	
 
	if (GB(image, 0, SPRITE_WIDTH) != 0) {
 
		DrawGroundSprite(image, GroundSpritePaletteTransform(image, pal, palette));
src/newgrf_industrytiles.cpp
Show inline comments
 
@@ -173,7 +173,7 @@ static void IndustryDrawTileLayout(const
 
	SpriteID image = dts->ground.sprite;
 
	SpriteID pal   = dts->ground.pal;
 

	
 
	if (IS_CUSTOM_SPRITE(image)) image += stage;
 
	if (HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE)) image += stage;
 

	
 
	if (GB(image, 0, SPRITE_WIDTH) != 0) {
 
		/* If the ground sprite is the default flat water sprite, draw also canal/river borders
src/newgrf_station.cpp
Show inline comments
 
@@ -900,7 +900,7 @@ bool DrawStationTile(int x, int y, RailT
 

	
 
	SpriteID image = sprites->ground.sprite;
 
	SpriteID pal = sprites->ground.pal;
 
	if (HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) {
 
	if (HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE)) {
 
		image += GetCustomStationGroundRelocation(statspec, NULL, INVALID_TILE);
 
		image += rti->custom_ground_offset;
 
	} else {
src/sprite.cpp
Show inline comments
 
@@ -36,7 +36,7 @@ void DrawCommonTileSeq(const TileInfo *t
 
		/* Stop drawing sprite sequence once we meet a sprite that doesn't have to be opaque */
 
		if (IsInvisibilitySet(to) && !HasBit(image, SPRITE_MODIFIER_OPAQUE)) return;
 

	
 
		if (newgrf_offset == 0 || HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) {
 
		if (newgrf_offset == 0 || !HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE)) {
 
			image += orig_offset;
 
		} else {
 
			image += newgrf_offset;
 
@@ -75,7 +75,7 @@ void DrawCommonTileSeqInGUI(int x, int y
 

	
 
	foreach_draw_tile_seq(dtss, dts->seq) {
 
		SpriteID image = dtss->image.sprite;
 
		if (newgrf_offset == 0 || HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) {
 
		if (newgrf_offset == 0 || !HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE)) {
 
			image += orig_offset;
 
		} else {
 
			image += newgrf_offset;
src/sprite.h
Show inline comments
 
@@ -20,15 +20,6 @@
 
#define GENERAL_SPRITE_COLOUR(colour) ((colour) + PALETTE_RECOLOUR_START)
 
#define COMPANY_SPRITE_COLOUR(owner) (GENERAL_SPRITE_COLOUR(_company_colours[owner]))
 

	
 
/**
 
 * Whether a sprite comes from the original graphics files or a new grf file
 
 * (either supplied by OpenTTD or supplied by the user).
 
 *
 
 * @param sprite The sprite to check
 
 * @return True if it is a new sprite, or false if it is original.
 
 */
 
#define IS_CUSTOM_SPRITE(sprite) ((sprite) >= SPR_SIGNALS_BASE)
 

	
 
/* The following describes bunch of sprites to be drawn together in a single 3D
 
 * bounding box. Used especially for various multi-sprite buildings (like
 
 * depots or stations): */
src/station_cmd.cpp
Show inline comments
 
@@ -2427,7 +2427,7 @@ static void DrawTile_Station(TileInfo *t
 
	} else {
 
		SpriteID image = t->ground.sprite;
 
		SpriteID pal   = t->ground.pal;
 
		if (HasBit(image, SPRITE_MODIFIER_USE_OFFSET)) {
 
		if (HasBit(image, SPRITE_MODIFIER_CUSTOM_SPRITE)) {
 
			image += GetCustomStationGroundRelocation(statspec, st, ti->tile);
 
			image += custom_ground_offset;
 
		} else {
src/table/sprites.h
Show inline comments
 
@@ -1419,7 +1419,7 @@ enum AnimCursors {
 
enum SpriteSetup {
 
	TRANSPARENT_BIT = 31,       ///< toggles transparency in the sprite
 
	RECOLOUR_BIT = 30,          ///< toggles recolouring in the sprite
 
	OFFSET_BIT = 29,
 
	CUSTOM_BIT = 29,
 
	OPAQUE_BIT = 28,
 

	
 
	PALETTE_WIDTH = 24,         ///< number of bits of the sprite containing the recolour palette
 
@@ -1435,7 +1435,8 @@ enum SpriteSetup {
 
 * @see SpriteSetup
 
 */
 
enum Modifiers {
 
	SPRITE_MODIFIER_USE_OFFSET    = OFFSET_BIT,
 
	/** Set when a sprite originates from an Action 1 */
 
	SPRITE_MODIFIER_CUSTOM_SPRITE = CUSTOM_BIT,
 
	/** Set when a sprite must not ever be displayed transparently */
 
	SPRITE_MODIFIER_OPAQUE        = OPAQUE_BIT,
 
	/** when a sprite is to be displayed transparently, this bit needs to be set. */
0 comments (0 inline, 0 general)