mirror of https://github.com/OpenTTD/OpenTTD.git
(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.
This commit is contained in:
parent
729cebda47
commit
331b8dd7d4
|
@ -514,7 +514,7 @@ static const BubbleMovement * const _bubble_movement[] = {
|
||||||
|
|
||||||
static void BubbleTick(Vehicle *v)
|
static void BubbleTick(Vehicle *v)
|
||||||
{
|
{
|
||||||
uint et;
|
uint anim_state;
|
||||||
|
|
||||||
v->progress++;
|
v->progress++;
|
||||||
if ((v->progress & 3) != 0) return;
|
if ((v->progress & 3) != 0) return;
|
||||||
|
@ -533,12 +533,12 @@ static void BubbleTick(Vehicle *v)
|
||||||
} else {
|
} else {
|
||||||
v->spritenum = 6;
|
v->spritenum = 6;
|
||||||
}
|
}
|
||||||
et = 0;
|
anim_state = 0;
|
||||||
} else {
|
} 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) {
|
if (b->y == 4 && b->x == 0) {
|
||||||
EndVehicleMove(v);
|
EndVehicleMove(v);
|
||||||
|
@ -551,21 +551,21 @@ static void BubbleTick(Vehicle *v)
|
||||||
v->spritenum = 5;
|
v->spritenum = 5;
|
||||||
SndPlayVehicleFx(SND_2F_POP, v);
|
SndPlayVehicleFx(SND_2F_POP, v);
|
||||||
}
|
}
|
||||||
et = 0;
|
anim_state = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (b->y == 4 && b->x == 2) {
|
if (b->y == 4 && b->x == 2) {
|
||||||
TileIndex tile;
|
TileIndex tile;
|
||||||
|
|
||||||
et++;
|
anim_state++;
|
||||||
SndPlayVehicleFx(SND_31_EXTRACT, v);
|
SndPlayVehicleFx(SND_31_EXTRACT, v);
|
||||||
|
|
||||||
tile = TileVirtXY(v->x_pos, v->y_pos);
|
tile = TileVirtXY(v->x_pos, v->y_pos);
|
||||||
if (IsTileType(tile, MP_INDUSTRY) && GetIndustryGfx(tile) == GFX_BUBBLE_CATCHER) AddAnimatedTile(tile);
|
if (IsTileType(tile, MP_INDUSTRY) && GetIndustryGfx(tile) == GFX_BUBBLE_CATCHER) AddAnimatedTile(tile);
|
||||||
}
|
}
|
||||||
|
|
||||||
v->engine_type = et;
|
v->u.effect.animation_state = anim_state;
|
||||||
b = &_bubble_movement[v->spritenum - 1][et];
|
b = &_bubble_movement[v->spritenum - 1][anim_state];
|
||||||
|
|
||||||
v->x_pos += b->x;
|
v->x_pos += b->x;
|
||||||
v->y_pos += b->y;
|
v->y_pos += b->y;
|
||||||
|
|
Loading…
Reference in New Issue