unmovable_cmd.c
changeset 384 bf1303e754ff
parent 222 b88456001397
child 405 6830ae7a0d5d
equal deleted inserted replaced
383:eb6be25facd2 384:bf1303e754ff
     2 #include "ttd.h"
     2 #include "ttd.h"
     3 #include "command.h"
     3 #include "command.h"
     4 #include "viewport.h"
     4 #include "viewport.h"
     5 #include "player.h"
     5 #include "player.h"
     6 #include "gui.h"
     6 #include "gui.h"
       
     7 #include "station.h"
     7 #include "economy.h"
     8 #include "economy.h"
     8 #include "town.h"
     9 #include "town.h"
     9 
    10 
    10 typedef struct DrawTileUnmovableStruct {
    11 typedef struct DrawTileUnmovableStruct {
    11 	uint16 image;
    12 	uint16 image;
    15 	byte height;
    16 	byte height;
    16 	byte z_size;
    17 	byte z_size;
    17 	byte unused;
    18 	byte unused;
    18 } DrawTileUnmovableStruct;
    19 } DrawTileUnmovableStruct;
    19 
    20 
    20 typedef struct DrawTileSeqStruct {
       
    21 	int8 delta_x;
       
    22 	int8 delta_y;
       
    23 	int8 delta_z;
       
    24 	byte width,height;
       
    25 	byte unk;
       
    26 	SpriteID image;
       
    27 } DrawTileSeqStruct;
       
    28 
       
    29 #include "table/unmovable_land.h"
    21 #include "table/unmovable_land.h"
    30 
    22 
    31 static void DrawTile_Unmovable(TileInfo *ti)
    23 static void DrawTile_Unmovable(TileInfo *ti)
    32 {
    24 {
    33 	uint32 image, ormod;
    25 	uint32 image, ormod;
    75 				dtus->width, dtus->height,
    67 				dtus->width, dtus->height,
    76 				dtus->z_size, ti->z);
    68 				dtus->z_size, ti->z);
    77 		}
    69 		}
    78 	} else {
    70 	} else {
    79 		const DrawTileSeqStruct *dtss;
    71 		const DrawTileSeqStruct *dtss;
    80 		const byte *t;
    72 		const DrawTileSprites *t;
    81 
    73 
    82 		if (ti->tileh) DrawFoundation(ti, ti->tileh);
    74 		if (ti->tileh) DrawFoundation(ti, ti->tileh);
    83 
    75 
    84 		ormod = PLAYER_SPRITE_COLOR(_map_owner[ti->tile]);
    76 		ormod = PLAYER_SPRITE_COLOR(_map_owner[ti->tile]);
    85 
    77 
    86 		t = _unmovable_display_datas[ti->map5 & 0x7F];
    78 		t = &_unmovable_display_datas[ti->map5 & 0x7F];
    87 		DrawGroundSprite(*(const uint16*)t | ormod);
    79 		DrawGroundSprite(t->ground_sprite | ormod);
    88 
    80 
    89 		t += sizeof(uint16);
    81 		foreach_draw_tile_seq(dtss, t->seq) {
    90 
       
    91 		for(dtss = (const DrawTileSeqStruct *)t; (byte)dtss->delta_x != 0x80; dtss++) {
       
    92 			image =	dtss->image;
    82 			image =	dtss->image;
    93 			if (_display_opt & DO_TRANS_BUILDINGS) {
    83 			if (_display_opt & DO_TRANS_BUILDINGS) {
    94 				image |= ormod;
    84 				image |= ormod;
    95 			} else {
    85 			} else {
    96 				image = (image & 0x3FFF) | 0x03224000;
    86 				image = (image & 0x3FFF) | 0x03224000;