MCPcopy Create free account
hub / github.com/OpenTTD/OpenTTD / AnimateMineTower

Function AnimateMineTower

src/industry_cmd.cpp:659–689  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

657}
658
659static void AnimateMineTower(TileIndex tile)
660{
661 int state = TimerGameTick::counter & 0x7FF;
662
663 if ((state -= 0x400) < 0) return;
664
665 if (state < 0x1A0) {
666 if (state < 0x20 || state >= 0x180) {
667 uint8_t m = GetAnimationFrame(tile);
668 if (!(m & 0x40)) {
669 SetAnimationFrame(tile, m | 0x40);
670 if (_settings_client.sound.ambient) SndPlayTileFx(SND_0B_MINE, tile);
671 }
672 if (state & 7) return;
673 } else {
674 if (state & 3) return;
675 }
676 uint8_t m = (GetAnimationFrame(tile) + 1) | 0x40;
677 if (m > 0xC2) m = 0xC0;
678 SetAnimationFrame(tile, m);
679 MarkTileDirtyByTile(tile);
680 } else if (state >= 0x200 && state < 0x3A0) {
681 int i = (state < 0x220 || state >= 0x380) ? 7 : 3;
682 if (state & i) return;
683
684 uint8_t m = (GetAnimationFrame(tile) & 0xBF) - 1;
685 if (m < 0x80) m = 0x82;
686 SetAnimationFrame(tile, m);
687 MarkTileDirtyByTile(tile);
688 }
689}
690
691static void AnimateTile_Industry(TileIndex tile)
692{

Callers 1

AnimateTile_IndustryFunction · 0.85

Calls 4

GetAnimationFrameFunction · 0.85
SetAnimationFrameFunction · 0.85
SndPlayTileFxFunction · 0.85
MarkTileDirtyByTileFunction · 0.70

Tested by

no test coverage detected