Changeset - r10633:cc700b638949
[Not reviewed]
master
0 1 0
rubidium - 15 years ago 2009-01-09 09:50:33
rubidium@openttd.org
(svn r14931) -Fix [FS#2512]: the "animation state" of the bubbles was stored in a variable that was not stored in the savegame. Using a variable that gets saved in the savegame solves the desync and makes it a bit clearer.
1 file changed with 8 insertions and 8 deletions:
0 comments (0 inline, 0 general)
src/effectvehicle.cpp
Show inline comments
 
@@ -511,13 +511,13 @@ static const BubbleMovement * const _bub
 
	_bubble_burst,
 
	_bubble_absorb,
 
};
 

	
 
static void BubbleTick(Vehicle *v)
 
{
 
	uint et;
 
	uint anim_state;
 

	
 
	v->progress++;
 
	if ((v->progress & 3) != 0) return;
 

	
 
	BeginVehicleMove(v);
 

	
 
@@ -530,45 +530,45 @@ static void BubbleTick(Vehicle *v)
 
		}
 
		if (v->u.effect.animation_substate != 0) {
 
			v->spritenum = GB(Random(), 0, 2) + 1;
 
		} else {
 
			v->spritenum = 6;
 
		}
 
		et = 0;
 
		anim_state = 0;
 
	} else {
 
		et = v->engine_type + 1;
 
		anim_state = v->u.effect.animation_state + 1;
 
	}
 

	
 
	const BubbleMovement *b = &_bubble_movement[v->spritenum - 1][et];
 
	const BubbleMovement *b = &_bubble_movement[v->spritenum - 1][anim_state];
 

	
 
	if (b->y == 4 && b->x == 0) {
 
		EndVehicleMove(v);
 
		delete v;
 
		return;
 
	}
 

	
 
	if (b->y == 4 && b->x == 1) {
 
		if (v->z_pos > 180 || Chance16I(1, 96, Random())) {
 
			v->spritenum = 5;
 
			SndPlayVehicleFx(SND_2F_POP, v);
 
		}
 
		et = 0;
 
		anim_state = 0;
 
	}
 

	
 
	if (b->y == 4 && b->x == 2) {
 
		TileIndex tile;
 

	
 
		et++;
 
		anim_state++;
 
		SndPlayVehicleFx(SND_31_EXTRACT, v);
 

	
 
		tile = TileVirtXY(v->x_pos, v->y_pos);
 
		if (IsTileType(tile, MP_INDUSTRY) && GetIndustryGfx(tile) == GFX_BUBBLE_CATCHER) AddAnimatedTile(tile);
 
	}
 

	
 
	v->engine_type = et;
 
	b = &_bubble_movement[v->spritenum - 1][et];
 
	v->u.effect.animation_state = anim_state;
 
	b = &_bubble_movement[v->spritenum - 1][anim_state];
 

	
 
	v->x_pos += b->x;
 
	v->y_pos += b->y;
 
	v->z_pos += b->z;
 
	v->cur_image = SPR_BUBBLE_0 + b->image;
 

	
0 comments (0 inline, 0 general)