draws the telcom background, handles flickering lights, power button etc
| 1705 | #define NEON_OFF3_TIME 0.02 |
| 1706 | // draws the telcom background, handles flickering lights, power button etc |
| 1707 | void TelcomDrawScreen(bool poweron, bool powerup) { |
| 1708 | static int neon_state = NEON_OFF; |
| 1709 | static float start_time = 0; |
| 1710 | static float off_time = 0, on_time = 0; |
| 1711 | |
| 1712 | if (powerup) { |
| 1713 | neon_state = NEON_OFF; |
| 1714 | start_time = timer_GetTime(); |
| 1715 | off_time = myrand(5); |
| 1716 | } |
| 1717 | |
| 1718 | switch (neon_state) { |
| 1719 | case NEON_OFF: |
| 1720 | if (((timer_GetTime() - start_time) > off_time) && (myrand(100.0) >= NEON_STATEOFF)) { |
| 1721 | start_time = timer_GetTime(); |
| 1722 | neon_state = NEON_ON1; |
| 1723 | } |
| 1724 | break; |
| 1725 | case NEON_ON1: |
| 1726 | TelcomStartSound(TCSND_LIGHTBULB); |
| 1727 | if ((timer_GetTime() - start_time) > NEON_ON1_TIME) { |
| 1728 | start_time = timer_GetTime(); |
| 1729 | neon_state = NEON_OFF2; |
| 1730 | } |
| 1731 | break; |
| 1732 | case NEON_OFF2: |
| 1733 | if ((timer_GetTime() - start_time) > NEON_OFF2_TIME) { |
| 1734 | start_time = timer_GetTime(); |
| 1735 | neon_state = NEON_ON2; |
| 1736 | } |
| 1737 | break; |
| 1738 | case NEON_ON2: |
| 1739 | if ((timer_GetTime() - start_time) > NEON_ON2_TIME) { |
| 1740 | start_time = timer_GetTime(); |
| 1741 | neon_state = NEON_OFF3; |
| 1742 | } |
| 1743 | break; |
| 1744 | case NEON_OFF3: |
| 1745 | if ((timer_GetTime() - start_time) > NEON_OFF3_TIME) { |
| 1746 | start_time = timer_GetTime(); |
| 1747 | neon_state = NEON_ON3; |
| 1748 | on_time = myrand(3); |
| 1749 | } |
| 1750 | break; |
| 1751 | case NEON_ON3: |
| 1752 | if (((timer_GetTime() - start_time) > on_time) && (myrand(100.0) < NEON_STATEOFF)) { |
| 1753 | start_time = timer_GetTime(); |
| 1754 | neon_state = NEON_OFF; |
| 1755 | off_time = myrand(5); |
| 1756 | } |
| 1757 | break; |
| 1758 | } |
| 1759 | |
| 1760 | rend_SetFiltering(0); |
| 1761 | |
| 1762 | // draw telcom background |
| 1763 | rend_DrawChunkedBitmap(&Telcom_bitmap, 0, 0, 255); |
| 1764 |
no test coverage detected