ReadNextFrame
()
| 1675 | * ReadNextFrame |
| 1676 | */ |
| 1677 | private static byte[] ReadNextFrame() { |
| 1678 | |
| 1679 | ByteBuffer file = ClientGlobals.cl.cinematic_file; |
| 1680 | |
| 1681 | // read the next frame |
| 1682 | int command = file.getInt(); |
| 1683 | |
| 1684 | if (command == 2) { |
| 1685 | // last frame marker |
| 1686 | return null; |
| 1687 | } |
| 1688 | |
| 1689 | if (command == 1) { |
| 1690 | // read palette |
| 1691 | file.get(ClientGlobals.cl.cinematicpalette); |
| 1692 | // dubious.... exposes an edge case |
| 1693 | ClientGlobals.cl.cinematicpalette_active = false; |
| 1694 | } |
| 1695 | // decompress the next frame |
| 1696 | int size = file.getInt(); |
| 1697 | if (size > compressed.length || size < 1) |
| 1698 | Com.Error(ERR_DROP, "Bad compressed frame size:" + size); |
| 1699 | |
| 1700 | file.get(compressed, 0, size); |
| 1701 | |
| 1702 | // read sound |
| 1703 | int start = ClientGlobals.cl.cinematicframe * cin.s_rate / 14; |
| 1704 | int end = (ClientGlobals.cl.cinematicframe + 1) * cin.s_rate / 14; |
| 1705 | int count = end - start; |
| 1706 | |
| 1707 | S.RawSamples(count, cin.s_rate, cin.s_width, cin.s_channels, file.slice()); |
| 1708 | // skip the sound samples |
| 1709 | file.position(file.position() + count * cin.s_width * cin.s_channels); |
| 1710 | |
| 1711 | byte[] pic = Huff1Decompress(compressed, size); |
| 1712 | ClientGlobals.cl.cinematicframe++; |
| 1713 | |
| 1714 | return pic; |
| 1715 | } |
| 1716 | |
| 1717 | /** |
| 1718 | * RunCinematic |
no test coverage detected