mirror of
https://github.com/1dot13/source.git
synced 2026-07-29 13:52:17 +02:00
The color-shift opcode copies a run of palette entries from the previous frame's palette to the current one. libsmacker rejected the copy when the source and destination ranges overlapped, aborting the whole palette decode and leaving the palette half-updated -- so every frame from the first such opcode on rendered with a mix of the new and stale palette. The overlap check is bogus: the copy reads from oldPalette, a snapshot taken at the top of the function, and writes into s->palette, a separate buffer, so overlapping ranges are harmless (and it is a memmove regardless). ffmpeg and the original SMACKW32.DLL have no such check. Several of the videos that ship with the game (Rebel_cr, Omerta, Prague) use these overlapping copies, and showed washed-out colours with the previous frame's palette bleeding through. Drop the overlap clause, keep the real 256-entry bounds checks. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>