123 |
123 |
124 if (!IsIndustryCompleted(ti->tile)) return; |
124 if (!IsIndustryCompleted(ti->tile)) return; |
125 |
125 |
126 d = &_draw_industry_spec1[GetIndustryAnimationState(ti->tile)]; |
126 d = &_draw_industry_spec1[GetIndustryAnimationState(ti->tile)]; |
127 |
127 |
128 AddChildSpriteScreen(SPR_IT_SUGAR_MINE_SIEVE + d->image_1, d->x, 0); |
128 AddChildSpriteScreen(SPR_IT_SUGAR_MINE_SIEVE + d->image_1, PAL_NONE, d->x, 0); |
129 |
129 |
130 image = d->image_2; |
130 image = d->image_2; |
131 if (image != 0) AddChildSpriteScreen(SPR_IT_SUGAR_MINE_CLOUDS + image - 1, 8, 41); |
131 if (image != 0) AddChildSpriteScreen(SPR_IT_SUGAR_MINE_CLOUDS + image - 1, PAL_NONE, 8, 41); |
132 |
132 |
133 image = d->image_3; |
133 image = d->image_3; |
134 if (image != 0) { |
134 if (image != 0) { |
135 AddChildSpriteScreen(SPR_IT_SUGAR_MINE_PILE + image - 1, |
135 AddChildSpriteScreen(SPR_IT_SUGAR_MINE_PILE + image - 1, PAL_NONE, |
136 _drawtile_proc1_x[image - 1], _drawtile_proc1_y[image - 1]); |
136 _drawtile_proc1_x[image - 1], _drawtile_proc1_y[image - 1]); |
137 } |
137 } |
138 } |
138 } |
139 |
139 |
140 static void IndustryDrawToffeeQuarry(const TileInfo *ti) |
140 static void IndustryDrawToffeeQuarry(const TileInfo *ti) |
145 x = _industry_anim_offs[GetIndustryAnimationState(ti->tile)]; |
145 x = _industry_anim_offs[GetIndustryAnimationState(ti->tile)]; |
146 if ( (byte)x == 0xFF) |
146 if ( (byte)x == 0xFF) |
147 x = 0; |
147 x = 0; |
148 } |
148 } |
149 |
149 |
150 AddChildSpriteScreen(SPR_IT_TOFFEE_QUARRY_SHOVEL, 22 - x, 24 + x); |
150 AddChildSpriteScreen(SPR_IT_TOFFEE_QUARRY_SHOVEL, PAL_NONE, 22 - x, 24 + x); |
151 AddChildSpriteScreen(SPR_IT_TOFFEE_QUARRY_TOFFEE, 6, 14); |
151 AddChildSpriteScreen(SPR_IT_TOFFEE_QUARRY_TOFFEE, PAL_NONE, 6, 14); |
152 } |
152 } |
153 |
153 |
154 static void IndustryDrawBubbleGenerator( const TileInfo *ti) |
154 static void IndustryDrawBubbleGenerator( const TileInfo *ti) |
155 { |
155 { |
156 if (IsIndustryCompleted(ti->tile)) { |
156 if (IsIndustryCompleted(ti->tile)) { |
157 AddChildSpriteScreen(SPR_IT_BUBBLE_GENERATOR_BUBBLE, 5, _industry_anim_offs_2[GetIndustryAnimationState(ti->tile)]); |
157 AddChildSpriteScreen(SPR_IT_BUBBLE_GENERATOR_BUBBLE, PAL_NONE, 5, _industry_anim_offs_2[GetIndustryAnimationState(ti->tile)]); |
158 } else { |
158 } else { |
159 AddChildSpriteScreen(SPR_IT_BUBBLE_GENERATOR_SPRING, 3, 67); |
159 AddChildSpriteScreen(SPR_IT_BUBBLE_GENERATOR_SPRING, PAL_NONE, 3, 67); |
160 } |
160 } |
161 } |
161 } |
162 |
162 |
163 static void IndustryDrawToyFactory(const TileInfo *ti) |
163 static void IndustryDrawToyFactory(const TileInfo *ti) |
164 { |
164 { |
165 const DrawIndustrySpec4Struct *d; |
165 const DrawIndustrySpec4Struct *d; |
166 |
166 |
167 d = &_industry_anim_offs_3[GetIndustryAnimationState(ti->tile)]; |
167 d = &_industry_anim_offs_3[GetIndustryAnimationState(ti->tile)]; |
168 |
168 |
169 if (d->image_1 != 0xFF) { |
169 if (d->image_1 != 0xFF) { |
170 AddChildSpriteScreen(SPR_IT_TOY_FACTORY_CLAY, 50 - d->image_1 * 2, 96 + d->image_1); |
170 AddChildSpriteScreen(SPR_IT_TOY_FACTORY_CLAY, PAL_NONE, 50 - d->image_1 * 2, 96 + d->image_1); |
171 } |
171 } |
172 |
172 |
173 if (d->image_2 != 0xFF) { |
173 if (d->image_2 != 0xFF) { |
174 AddChildSpriteScreen(SPR_IT_TOY_FACTORY_ROBOT, 16 - d->image_2 * 2, 100 + d->image_2); |
174 AddChildSpriteScreen(SPR_IT_TOY_FACTORY_ROBOT, PAL_NONE, 16 - d->image_2 * 2, 100 + d->image_2); |
175 } |
175 } |
176 |
176 |
177 AddChildSpriteScreen(SPR_IT_TOY_FACTORY_STAMP, 7, d->image_3); |
177 AddChildSpriteScreen(SPR_IT_TOY_FACTORY_STAMP, PAL_NONE, 7, d->image_3); |
178 AddChildSpriteScreen(SPR_IT_TOY_FACTORY_STAMP_HOLDER, 0, 42); |
178 AddChildSpriteScreen(SPR_IT_TOY_FACTORY_STAMP_HOLDER, PAL_NONE, 0, 42); |
179 } |
179 } |
180 |
180 |
181 static void IndustryDrawCoalPlantSparks(const TileInfo *ti) |
181 static void IndustryDrawCoalPlantSparks(const TileInfo *ti) |
182 { |
182 { |
183 if (IsIndustryCompleted(ti->tile)) { |
183 if (IsIndustryCompleted(ti->tile)) { |
184 uint image = GetIndustryAnimationState(ti->tile); |
184 uint image = GetIndustryAnimationState(ti->tile); |
185 |
185 |
186 if (image != 0 && image < 7) { |
186 if (image != 0 && image < 7) { |
187 AddChildSpriteScreen(image + SPR_IT_POWER_PLANT_TRANSFORMERS, |
187 AddChildSpriteScreen(image + SPR_IT_POWER_PLANT_TRANSFORMERS, |
|
188 PAL_NONE, |
188 _coal_plant_sparks_x[image - 1], |
189 _coal_plant_sparks_x[image - 1], |
189 _coal_plant_sparks_y[image - 1] |
190 _coal_plant_sparks_y[image - 1] |
190 ); |
191 ); |
191 } |
192 } |
192 } |
193 } |
205 { |
206 { |
206 const IndustryGfx gfx = GetIndustryGfx(ti->tile); |
207 const IndustryGfx gfx = GetIndustryGfx(ti->tile); |
207 const Industry *ind; |
208 const Industry *ind; |
208 const DrawBuildingsTileStruct *dits; |
209 const DrawBuildingsTileStruct *dits; |
209 byte z; |
210 byte z; |
210 uint32 image, ormod; |
211 SpriteID image; |
|
212 SpriteID pal; |
211 |
213 |
212 /* Pointer to industry */ |
214 /* Pointer to industry */ |
213 ind = GetIndustryByTile(ti->tile); |
215 ind = GetIndustryByTile(ti->tile); |
214 ormod = GENERAL_SPRITE_COLOR(ind->random_color); |
|
215 |
216 |
216 /* Retrieve pointer to the draw industry tile struct */ |
217 /* Retrieve pointer to the draw industry tile struct */ |
217 dits = &_industry_draw_tile_data[gfx << 2 | (_industry_section_draw_animation_state[gfx] ? |
218 dits = &_industry_draw_tile_data[gfx << 2 | (_industry_section_draw_animation_state[gfx] ? |
218 GetIndustryAnimationState(ti->tile) & 3 : |
219 GetIndustryAnimationState(ti->tile) & 3 : |
219 GetIndustryConstructionStage(ti->tile))]; |
220 GetIndustryConstructionStage(ti->tile))]; |
220 |
221 |
221 image = dits->ground; |
222 image = dits->ground.sprite; |
222 if (image & PALETTE_MODIFIER_COLOR && (image & PALETTE_SPRITE_MASK) == 0) |
223 if (HASBIT(image, PALETTE_MODIFIER_COLOR) && dits->ground.pal == PAL_NONE) { |
223 image |= ormod; |
224 pal = GENERAL_SPRITE_COLOR(ind->random_color); |
|
225 } else { |
|
226 pal = dits->ground.pal; |
|
227 } |
224 |
228 |
225 z = ti->z; |
229 z = ti->z; |
226 /* Add bricks below the industry? */ |
230 /* Add bricks below the industry? */ |
227 if (ti->tileh != SLOPE_FLAT) { |
231 if (ti->tileh != SLOPE_FLAT) { |
228 AddSortableSpriteToDraw(SPR_FOUNDATION_BASE + ti->tileh, ti->x, ti->y, 16, 16, 7, z); |
232 AddSortableSpriteToDraw(SPR_FOUNDATION_BASE + ti->tileh, PAL_NONE, ti->x, ti->y, 16, 16, 7, z); |
229 AddChildSpriteScreen(image, 31, 1); |
233 AddChildSpriteScreen(image, pal, 31, 1); |
230 z += TILE_HEIGHT; |
234 z += TILE_HEIGHT; |
231 } else { |
235 } else { |
232 /* Else draw regular ground */ |
236 /* Else draw regular ground */ |
233 DrawGroundSprite(image); |
237 DrawGroundSprite(image, pal); |
234 } |
238 } |
235 |
239 |
236 /* Add industry on top of the ground? */ |
240 /* Add industry on top of the ground? */ |
237 image = dits->building; |
241 image = dits->building.sprite; |
238 if (image != 0) { |
242 if (image != 0) { |
239 if (image & PALETTE_MODIFIER_COLOR && (image & PALETTE_SPRITE_MASK) == 0) |
243 if (_display_opt & DO_TRANS_BUILDINGS) { |
240 image |= ormod; |
244 SETBIT(image, PALETTE_MODIFIER_TRANSPARENT); |
241 |
245 pal = PALETTE_TO_TRANSPARENT; |
242 if (_display_opt & DO_TRANS_BUILDINGS) MAKE_TRANSPARENT(image); |
246 } else { |
243 |
247 pal = dits->building.pal; |
244 AddSortableSpriteToDraw(image, |
248 } |
|
249 |
|
250 AddSortableSpriteToDraw(image, pal, |
245 ti->x + dits->subtile_x, |
251 ti->x + dits->subtile_x, |
246 ti->y + dits->subtile_y, |
252 ti->y + dits->subtile_y, |
247 dits->width + 1, |
253 dits->width + 1, |
248 dits->height + 1, |
254 dits->height + 1, |
249 dits->dz, |
255 dits->dz, |