Run animations at the normal rate regardless of day length factor.
This commit is contained in:
@@ -34,6 +34,7 @@ static const int DAYS_IN_YEAR = 365; ///< days per year
|
||||
static const int DAYS_IN_LEAP_YEAR = 366; ///< sometimes, you need one day more...
|
||||
|
||||
#define CURRENT_SCALED_TICKS (((((DateTicksScaled)_date * DAY_TICKS) + _date_fract) * _settings_game.economy.day_length_factor) + _tick_skip_counter)
|
||||
#define SCALED_TICK_COUNTER ((((uint32)_tick_counter) * _settings_game.economy.day_length_factor) + _tick_skip_counter)
|
||||
|
||||
#define DATE_UNIT_SIZE (_settings_client.gui.time_in_minutes ? _settings_client.gui.ticks_per_minute : (DAY_TICKS * _settings_game.economy.day_length_factor))
|
||||
|
||||
|
@@ -540,7 +540,7 @@ static void AnimateTile_Industry(TileIndex tile)
|
||||
|
||||
switch (gfx) {
|
||||
case GFX_SUGAR_MINE_SIEVE:
|
||||
if ((_tick_counter & 1) == 0) {
|
||||
if ((SCALED_TICK_COUNTER & 1) == 0) {
|
||||
byte m = GetAnimationFrame(tile) + 1;
|
||||
|
||||
if (_settings_client.sound.ambient) {
|
||||
@@ -561,7 +561,7 @@ static void AnimateTile_Industry(TileIndex tile)
|
||||
break;
|
||||
|
||||
case GFX_TOFFEE_QUARY:
|
||||
if ((_tick_counter & 3) == 0) {
|
||||
if ((SCALED_TICK_COUNTER & 3) == 0) {
|
||||
byte m = GetAnimationFrame(tile);
|
||||
|
||||
if (_industry_anim_offs_toffee[m] == 0xFF && _settings_client.sound.ambient) {
|
||||
@@ -579,7 +579,7 @@ static void AnimateTile_Industry(TileIndex tile)
|
||||
break;
|
||||
|
||||
case GFX_BUBBLE_CATCHER:
|
||||
if ((_tick_counter & 1) == 0) {
|
||||
if ((SCALED_TICK_COUNTER & 1) == 0) {
|
||||
byte m = GetAnimationFrame(tile);
|
||||
|
||||
if (++m >= 40) {
|
||||
@@ -594,7 +594,7 @@ static void AnimateTile_Industry(TileIndex tile)
|
||||
|
||||
/* Sparks on a coal plant */
|
||||
case GFX_POWERPLANT_SPARKS:
|
||||
if ((_tick_counter & 3) == 0) {
|
||||
if ((SCALED_TICK_COUNTER & 3) == 0) {
|
||||
byte m = GetAnimationFrame(tile);
|
||||
if (m == 6) {
|
||||
SetAnimationFrame(tile, 0);
|
||||
@@ -607,7 +607,7 @@ static void AnimateTile_Industry(TileIndex tile)
|
||||
break;
|
||||
|
||||
case GFX_TOY_FACTORY:
|
||||
if ((_tick_counter & 1) == 0) {
|
||||
if ((SCALED_TICK_COUNTER & 1) == 0) {
|
||||
byte m = GetAnimationFrame(tile) + 1;
|
||||
|
||||
switch (m) {
|
||||
@@ -635,7 +635,7 @@ static void AnimateTile_Industry(TileIndex tile)
|
||||
case GFX_PLASTIC_FOUNTAIN_ANIMATED_3: case GFX_PLASTIC_FOUNTAIN_ANIMATED_4:
|
||||
case GFX_PLASTIC_FOUNTAIN_ANIMATED_5: case GFX_PLASTIC_FOUNTAIN_ANIMATED_6:
|
||||
case GFX_PLASTIC_FOUNTAIN_ANIMATED_7: case GFX_PLASTIC_FOUNTAIN_ANIMATED_8:
|
||||
if ((_tick_counter & 3) == 0) {
|
||||
if ((SCALED_TICK_COUNTER & 3) == 0) {
|
||||
IndustryGfx gfx = GetIndustryGfx(tile);
|
||||
|
||||
gfx = (gfx < 155) ? gfx + 1 : 148;
|
||||
@@ -647,7 +647,7 @@ static void AnimateTile_Industry(TileIndex tile)
|
||||
case GFX_OILWELL_ANIMATED_1:
|
||||
case GFX_OILWELL_ANIMATED_2:
|
||||
case GFX_OILWELL_ANIMATED_3:
|
||||
if ((_tick_counter & 7) == 0) {
|
||||
if ((SCALED_TICK_COUNTER & 7) == 0) {
|
||||
bool b = Chance16(1, 7);
|
||||
IndustryGfx gfx = GetIndustryGfx(tile);
|
||||
|
||||
@@ -667,7 +667,7 @@ static void AnimateTile_Industry(TileIndex tile)
|
||||
case GFX_COAL_MINE_TOWER_ANIMATED:
|
||||
case GFX_COPPER_MINE_TOWER_ANIMATED:
|
||||
case GFX_GOLD_MINE_TOWER_ANIMATED: {
|
||||
int state = _tick_counter & 0x7FF;
|
||||
int state = SCALED_TICK_COUNTER & 0x7FF;
|
||||
|
||||
if ((state -= 0x400) < 0) return;
|
||||
|
||||
@@ -827,7 +827,7 @@ static void TileLoop_Industry(TileIndex tile)
|
||||
case GFX_COAL_MINE_TOWER_NOT_ANIMATED:
|
||||
case GFX_COPPER_MINE_TOWER_NOT_ANIMATED:
|
||||
case GFX_GOLD_MINE_TOWER_NOT_ANIMATED:
|
||||
if (!(_tick_counter & 0x400) && Chance16(1, 2)) {
|
||||
if (!(SCALED_TICK_COUNTER & 0x400) && Chance16(1, 2)) {
|
||||
switch (gfx) {
|
||||
case GFX_COAL_MINE_TOWER_NOT_ANIMATED: gfx = GFX_COAL_MINE_TOWER_ANIMATED; break;
|
||||
case GFX_COPPER_MINE_TOWER_NOT_ANIMATED: gfx = GFX_COPPER_MINE_TOWER_ANIMATED; break;
|
||||
@@ -850,7 +850,7 @@ static void TileLoop_Industry(TileIndex tile)
|
||||
case GFX_COAL_MINE_TOWER_ANIMATED:
|
||||
case GFX_COPPER_MINE_TOWER_ANIMATED:
|
||||
case GFX_GOLD_MINE_TOWER_ANIMATED:
|
||||
if (!(_tick_counter & 0x400)) {
|
||||
if (!(SCALED_TICK_COUNTER & 0x400)) {
|
||||
switch (gfx) {
|
||||
case GFX_COAL_MINE_TOWER_ANIMATED: gfx = GFX_COAL_MINE_TOWER_NOT_ANIMATED; break;
|
||||
case GFX_COPPER_MINE_TOWER_ANIMATED: gfx = GFX_COPPER_MINE_TOWER_NOT_ANIMATED; break;
|
||||
|
@@ -56,7 +56,7 @@ struct AnimationBase {
|
||||
* increasing this value by one doubles the wait. 0 is the minimum value
|
||||
* allowed for animation_speed, which corresponds to 30ms, and 16 is the
|
||||
* maximum, corresponding to around 33 minutes. */
|
||||
if (_tick_counter % (1 << animation_speed) != 0) return;
|
||||
if (SCALED_TICK_COUNTER % (1 << animation_speed) != 0) return;
|
||||
|
||||
uint8 frame = GetAnimationFrame(tile);
|
||||
uint8 num_frames = spec->animation.frames;
|
||||
|
@@ -1525,6 +1525,7 @@ void StateGameLoop()
|
||||
BasePersistentStorageArray::SwitchMode(PSM_ENTER_GAMELOOP);
|
||||
_tick_skip_counter++;
|
||||
if (_tick_skip_counter < _settings_game.economy.day_length_factor) {
|
||||
AnimateAnimatedTiles();
|
||||
CallVehicleTicks();
|
||||
} else {
|
||||
_tick_skip_counter = 0;
|
||||
|
@@ -399,7 +399,7 @@ static void AnimateTile_Town(TileIndex tile)
|
||||
return;
|
||||
}
|
||||
|
||||
if (_tick_counter & 3) return;
|
||||
if (SCALED_TICK_COUNTER & 3) return;
|
||||
|
||||
/* If the house is not one with a lift anymore, then stop this animating.
|
||||
* Not exactly sure when this happens, but probably when a house changes.
|
||||
|
Reference in New Issue
Block a user