src/industry_cmd.cpp
changeset 7015 af363e4290ab
parent 6989 43b359b4cb86
child 7056 b4f146586c97
equal deleted inserted replaced
7014:34b102f35fb9 7015:af363e4290ab
   135 	InvalidateWindow(WC_INDUSTRY_DIRECTORY, 0);
   135 	InvalidateWindow(WC_INDUSTRY_DIRECTORY, 0);
   136 }
   136 }
   137 
   137 
   138 static void IndustryDrawSugarMine(const TileInfo *ti)
   138 static void IndustryDrawSugarMine(const TileInfo *ti)
   139 {
   139 {
   140 	const DrawIndustrySpec1Struct *d;
   140 	const DrawIndustryAnimationStruct *d;
   141 	uint32 image;
       
   142 
   141 
   143 	if (!IsIndustryCompleted(ti->tile)) return;
   142 	if (!IsIndustryCompleted(ti->tile)) return;
   144 
   143 
   145 	d = &_draw_industry_spec1[GetIndustryAnimationState(ti->tile)];
   144 	d = &_draw_industry_spec1[GetIndustryAnimationState(ti->tile)];
   146 
   145 
   147 	AddChildSpriteScreen(SPR_IT_SUGAR_MINE_SIEVE + d->image_1, PAL_NONE, d->x, 0);
   146 	AddChildSpriteScreen(SPR_IT_SUGAR_MINE_SIEVE + d->image_1, PAL_NONE, d->x, 0);
   148 
   147 
   149 	image = d->image_2;
   148 	if (d->image_2 != 0) {
   150 	if (image != 0) AddChildSpriteScreen(SPR_IT_SUGAR_MINE_CLOUDS + image - 1, PAL_NONE, 8, 41);
   149 		AddChildSpriteScreen(SPR_IT_SUGAR_MINE_CLOUDS + d->image_2 - 1, PAL_NONE, 8, 41);
   151 
   150 	}
   152 	image = d->image_3;
   151 
   153 	if (image != 0) {
   152 	if (d->image_3 != 0) {
   154 		AddChildSpriteScreen(SPR_IT_SUGAR_MINE_PILE + image - 1, PAL_NONE,
   153 		AddChildSpriteScreen(SPR_IT_SUGAR_MINE_PILE + d->image_3 - 1, PAL_NONE,
   155 			_drawtile_proc1_x[image - 1], _drawtile_proc1_y[image - 1]);
   154 			_drawtile_proc1[d->image_3 - 1].x, _drawtile_proc1[d->image_3 - 1].y);
   156 	}
   155 	}
   157 }
   156 }
   158 
   157 
   159 static void IndustryDrawToffeeQuarry(const TileInfo *ti)
   158 static void IndustryDrawToffeeQuarry(const TileInfo *ti)
   160 {
   159 {
   161 	int x = 0;
   160 	uint8 x = 0;
   162 
   161 
   163 	if (IsIndustryCompleted(ti->tile)) {
   162 	if (IsIndustryCompleted(ti->tile)) {
   164 		x = _industry_anim_offs[GetIndustryAnimationState(ti->tile)];
   163 		x = _industry_anim_offs_toffee[GetIndustryAnimationState(ti->tile)];
   165 		if ( (byte)x == 0xFF)
   164 		if (x == 0xFF)
   166 			x = 0;
   165 			x = 0;
   167 	}
   166 	}
   168 
   167 
   169 	AddChildSpriteScreen(SPR_IT_TOFFEE_QUARRY_SHOVEL, PAL_NONE, 22 - x, 24 + x);
   168 	AddChildSpriteScreen(SPR_IT_TOFFEE_QUARRY_SHOVEL, PAL_NONE, 22 - x, 24 + x);
   170 	AddChildSpriteScreen(SPR_IT_TOFFEE_QUARRY_TOFFEE, PAL_NONE, 6, 14);
   169 	AddChildSpriteScreen(SPR_IT_TOFFEE_QUARRY_TOFFEE, PAL_NONE, 6, 14);
   171 }
   170 }
   172 
   171 
   173 static void IndustryDrawBubbleGenerator( const TileInfo *ti)
   172 static void IndustryDrawBubbleGenerator( const TileInfo *ti)
   174 {
   173 {
   175 	if (IsIndustryCompleted(ti->tile)) {
   174 	if (IsIndustryCompleted(ti->tile)) {
   176 		AddChildSpriteScreen(SPR_IT_BUBBLE_GENERATOR_BUBBLE, PAL_NONE, 5, _industry_anim_offs_2[GetIndustryAnimationState(ti->tile)]);
   175 		AddChildSpriteScreen(SPR_IT_BUBBLE_GENERATOR_BUBBLE, PAL_NONE, 5, _industry_anim_offs_bubbles[GetIndustryAnimationState(ti->tile)]);
   177 	} else {
   176 	} else {
   178 		AddChildSpriteScreen(SPR_IT_BUBBLE_GENERATOR_SPRING, PAL_NONE, 3, 67);
   177 		AddChildSpriteScreen(SPR_IT_BUBBLE_GENERATOR_SPRING, PAL_NONE, 3, 67);
   179 	}
   178 	}
   180 }
   179 }
   181 
   180 
   182 static void IndustryDrawToyFactory(const TileInfo *ti)
   181 static void IndustryDrawToyFactory(const TileInfo *ti)
   183 {
   182 {
   184 	const DrawIndustrySpec4Struct *d;
   183 	const DrawIndustryAnimationStruct *d;
   185 
   184 
   186 	d = &_industry_anim_offs_3[GetIndustryAnimationState(ti->tile)];
   185 	d = &_industry_anim_offs_toys[GetIndustryAnimationState(ti->tile)];
   187 
   186 
   188 	if (d->image_1 != 0xFF) {
   187 	if (d->image_1 != 0xFF) {
   189 		AddChildSpriteScreen(SPR_IT_TOY_FACTORY_CLAY, PAL_NONE, 50 - d->image_1 * 2, 96 + d->image_1);
   188 		AddChildSpriteScreen(SPR_IT_TOY_FACTORY_CLAY, PAL_NONE, d->x, 96 + d->image_1);
   190 	}
   189 	}
   191 
   190 
   192 	if (d->image_2 != 0xFF) {
   191 	if (d->image_2 != 0xFF) {
   193 		AddChildSpriteScreen(SPR_IT_TOY_FACTORY_ROBOT, PAL_NONE, 16 - d->image_2 * 2, 100 + d->image_2);
   192 		AddChildSpriteScreen(SPR_IT_TOY_FACTORY_ROBOT, PAL_NONE, 16 - d->image_2 * 2, 100 + d->image_2);
   194 	}
   193 	}
   198 }
   197 }
   199 
   198 
   200 static void IndustryDrawCoalPlantSparks(const TileInfo *ti)
   199 static void IndustryDrawCoalPlantSparks(const TileInfo *ti)
   201 {
   200 {
   202 	if (IsIndustryCompleted(ti->tile)) {
   201 	if (IsIndustryCompleted(ti->tile)) {
   203 		uint image = GetIndustryAnimationState(ti->tile);
   202 		uint8 image = GetIndustryAnimationState(ti->tile);
   204 
   203 
   205 		if (image != 0 && image < 7) {
   204 		if (image != 0 && image < 7) {
   206 			AddChildSpriteScreen(image + SPR_IT_POWER_PLANT_TRANSFORMERS,
   205 			AddChildSpriteScreen(image + SPR_IT_POWER_PLANT_TRANSFORMERS,
   207 				PAL_NONE,
   206 				PAL_NONE,
   208 				_coal_plant_sparks_x[image - 1],
   207 				_coal_plant_sparks[image - 1].x,
   209 				_coal_plant_sparks_y[image - 1]
   208 				_coal_plant_sparks[image - 1].y
   210 			);
   209 			);
   211 		}
   210 		}
   212 	}
   211 	}
   213 }
   212 }
   214 
   213 
   410 
   409 
   411 	case GFX_TOFFEE_QUARY:
   410 	case GFX_TOFFEE_QUARY:
   412 		if ((_tick_counter & 3) == 0) {
   411 		if ((_tick_counter & 3) == 0) {
   413 			m = GetIndustryAnimationState(tile);
   412 			m = GetIndustryAnimationState(tile);
   414 
   413 
   415 			if (_industry_anim_offs[m] == 0xFF) {
   414 			if (_industry_anim_offs_toffee[m] == 0xFF) {
   416 				SndPlayTileFx(SND_30_CARTOON_SOUND, tile);
   415 				SndPlayTileFx(SND_30_CARTOON_SOUND, tile);
   417 			}
   416 			}
   418 
   417 
   419 			if (++m >= 70) {
   418 			if (++m >= 70) {
   420 				m = 0;
   419 				m = 0;