Debian Patches
Status for gearhead/1.310+git20240929-1
| Patch | Description | Author | Forwarded | Bugs | Origin | Last update |
|---|---|---|---|---|---|---|
| terminal-drawing-order | Copied from https://github.com/jwvhewitt/gearhead-1/pull/86 =================================================================== |
no | ||||
| unixpaths | no | |||||
| dejavu-core | no | |||||
| fix-sdl3-compat-rendering | Fix sprite rendering broken by SDL3-compat stack (Patch by claude.ai) . On a default modern Debian/Ubuntu system the runtime SDL 1.2 library is the sdl12-compat shim, which now further sits on top of sdl2-compat, which sits on top of SDL3. The user's strace confirms this: libSDL-1.2.so.0, libSDL2-2.0.so.0 and libSDL3.so.0 are all loaded. SDL 1.2 idioms that worked on real SDL 1.2 (and on sdl12-compat directly against SDL2) fall over when the chain bottoms out at SDL3, because SDL3 changed surface semantics and the two-layer shim doesn't reliably re-implement every legacy detail. . Three concrete bugs caused by this: . 1. Mecha sprites disappear. The pilot-color recoloring routine (MakeSwapBitmap in sdlgfx.pp) used to create an 8-bit indexed surface with a curated palette, blit the 24-bit RGB mecha sprite into it (relying on SDL to color-quantize), and then redefine palette entries to substitute pilot colors. SDL3 dropped automatic RGB->indexed quantization in blits and sdl2-compat doesn't reimplement it: the blit silently writes no pixels, the destination's pre-filled colorkey blue stays, and the resulting "sprite" is fully transparent. Mecha vanish; their shadows (Items_Sprite, loaded with empty Color and bypassing MakeSwapBitmap) still render. Title-screen "shadows but no mecha". . 2. Translucent surfaces render solid. Water tiles, the infobox backdrop, and the mini-map sprite all relied on SDL_SetAlpha (per-surface alpha modulation, SDL_SRCALPHA) combined with the surface's colorkey for transparency. The screen format the AddSprite path converts to has no alpha mask (Amask=0), so the per-surface alpha modifier has nothing to multiply into and is silently dropped. The surface blits opaque, so water tiles are solid bright blue over the grass and the infobox is fully opaque. . 3. RGBA-source sprites render with the colorkey-blue background opaque. Wall sprites, mecha portrait sprites, and other RGBA-source PNGs load as SDL surfaces with a per-pixel alpha channel. On real SDL 1.2, SDL_SetColorKey followed by SDL_ConvertSurface(..., SDL_SRCCOLORKEY) converts the colorkey blue into transparent pixels in the destination. Under the shim chain this doesn't reliably happen for RGBA sources, so the converted surface still has the blue background as opaque pixels. DrawAlphaSprite (used for "fade nearby walls so you can see the player") makes the bug worse because SDL_SetAlpha on a colorkeyed surface drops the colorkey through the compat layer. In-game effect: every building wall renders as a solid blue block. . The unifying fix is to stop depending on SDL's flag-and-modifier transparency semantics and instead store per-pixel alpha in the surface, which every SDL stack handles identically. . - Rewrite MakeSwapBitmap to do the color swap directly in 24-bit RGB, inspecting each pixel's (r,g,b) to classify it as transparent / grey / red ramp / yellow ramp / green ramp, and writing the swap color scaled by the source intensity. No indexed intermediate. - Add BakeAlphaIntoSprite, which replaces a sprite's surface with an RGBA8888 copy: alpha=0 for colorkey-blue pixels, alpha=N elsewhere. - Call BakeAlphaIntoSprite(it, 255) at the end of AddSprite so every loaded sprite is normalized to per-pixel-alpha transparency. This is the fix for the wall-blue-block bug; it also makes every downstream alpha operation work on every stack. - Replace the static per-surface SDL_SetAlpha calls (water_sprite1, water_sprite2, infobox_backdrop, mini_map_sprite) with BakeAlphaIntoSprite(..., N). Idempotent over the AddSprite bake. - Rewrite DrawAlphaSprite to do the alpha blend manually pixel-by-pixel, skipping colorkey-blue pixels and blending the rest with Alpha_Level/255 over the destination. SDL_SetAlpha-via-shim drops the colorkey; manual blend respects it. Runs only for sprites within ~one tile of the camera center, so the per-frame cost is negligible. . Verified by building gearhead-sdl against the user's source plus these changes and running under both (a) system sdl12-compat 1.2.68 with no sdl2-compat in the chain and (b) sdl12-compat 1.2.76 + sdl2-compat + SDL3 all built from upstream, which reproduces the user's reported breakage. Before the patch (a) renders correctly while (b) shows mecha vanish, water solid, and walls as blue blocks. After the patch both stacks render correctly across multiple random map seeds (mecha visible on shadows, water properly translucent, wall sprites show their actual texture). |
Kari Pahula <kaol@debian.org> | invalid | 2026-05-16 |
All known versions for source package 'gearhead'
- 1.310+git20240929-1 (sid)
- 1.310-4 (forky)
- 1.310-3 (bookworm, trixie)
