Skip to content

Maphack: real wall transparency via a second layered window#174

Draft
imm0r wants to merge 1 commit into
masterfrom
claude/overlay-maphack-transparency-zcs5rb
Draft

Maphack: real wall transparency via a second layered window#174
imm0r wants to merge 1 commit into
masterfrom
claude/overlay-maphack-transparency-zcs5rb

Conversation

@imm0r

@imm0r imm0r commented Jul 9, 2026

Copy link
Copy Markdown
Owner

Summary

In labyrinth-style map layouts (many nested narrow corridors) the memory maphack draws so many wall outlines in a small screen area that real in-game enemies underneath become hard to see. Every border pixel is fully opaque, because the radar overlay uses colour-key transparency (LWA_COLORKEY + one global LWA_ALPHA) — there is no per-pixel alpha, and lowering the one global alpha would also dim the radar dots and labels.

This PR adds the one form of real transparency the model does offer: per-layer alpha via a second layered window. RadarOverlay now owns a second click-through layered window kept directly below the radar window in the topmost band. When the new wall alpha (g_mapHackAlpha, 20–255) is below 255, the map layers (wall borders + unexplored wash) render into that window's own back-buffer and genuinely alpha-blend with the game underneath — enemies stay visible through dense wall clusters — while dots, labels and paths on the radar window keep full opacity. At the default 255 nothing changes: the layers draw into the radar back-buffer exactly as before (zero extra cost), and any window/buffer creation failure falls back to the classic path.

Changes

  • ahk/RadarOverlay.ahk — new _Ml* helpers (lazily created layer window, back-buffer, present/hide/destroy); the large-map layer draw routes into the layer window when g_mapHackAlpha < 255; _DrawMapLayersCached / _DrawMapLayersDirect gained an optional target-DC parameter (shared scroll cache untouched); HUD + loot-label clip exclusions are collected per frame and applied to both destinations; _FinishFrame hides the layer window on any frame that did not use it; Hide() override + destructor cover teardown.
  • InGameStateMonitor.ahk — seed g_mapHackAlpha := 255; version bump to 0.45.13.299.
  • ahk/ConfigManager.ahk — persist [Radar] mapHackAlpha (clamped 20–255).
  • ahk/BridgeDispatch.ahk — new SetMapHackAlpha bridge case.
  • ahk/WebViewBridge.ahkmapHackAlpha in the header push.
  • ui/index.html — "↳ Wall opacity" slider under Config → Overlay → Map Hack (live oninput, % bubble, activeElement guard on header sync); hidden while the maphack source is "ggpk" (the slider only affects the memory overlay).
  • CLAUDE.md / README.md — feature documentation + version sync.

Test plan

  • Static verification: brace balance on all edited AHK files; node --check on the extracted inline UI script; <div> balance unchanged vs. HEAD; CRLF preserved in BridgeDispatch.ahk / WebViewBridge.ahk.
  • In-game: on a large map with the memory maphack, drag Wall opacity to ~40–60 % — wall outlines become see-through (enemies/ground visible through them) while dots/labels stay crisp.
  • In-game: the wall layer stays under the dots and above the game, hides with the map/radar, and HUD + loot-label exclusion zones stay clear.
  • In-game: no perf regression (one extra full-window BitBlt per frame only while alpha < 255; at 255 the old path runs unchanged).

Notes for the reviewer

  • Colour-key windows cannot do per-pixel alpha, so this is deliberately per-layer: the whole wall window blends at one alpha. Both map layers ride it (wall borders + unexplored wash) because they share the composite scroll cache and both are "map paint over the game".
  • The below-radar z-order is re-asserted on the same cadence as the base topmost heal (SetWindowPos insertAfter=radar); inserting after a topmost window keeps the layer in the topmost band.

🤖 Generated with Claude Code

https://claude.ai/code/session_013UCQfY5KTNcmggpfapfciC


Generated by Claude Code

In labyrinth-style map layouts the maphack draws many wall outlines in a
small area, and every border pixel is fully opaque (colour-key rendering
has no per-pixel alpha) — real in-game enemies underneath become hard to
see. The one global window alpha is no fix because it also dims the radar
dots and labels.

Exploit the one real transparency the model offers: a whole layered window
has its own LWA_ALPHA. RadarOverlay now owns a second click-through
layered window (_Ml* helpers) kept directly below the radar window in the
topmost band; when the new wall alpha g_mapHackAlpha is < 255, the map
layers (wall borders + unexplored wash) render into that window's own
back-buffer — same scroll cache, same HUD/loot-label clip exclusions —
and genuinely alpha-blend with the game underneath, while dots/labels on
the radar window keep full opacity.

At the default alpha 255 the layers draw into the radar back-buffer
exactly as before (zero extra cost), and any window/buffer creation
failure falls back to the classic path. The layer window hides on any
frame that did not use it and follows radar hide/teardown.

Wiring: [Radar] mapHackAlpha persistence, SetMapHackAlpha bridge case,
mapHackAlpha header key, and a "Wall opacity" slider in Config -> Overlay
-> Map Hack (hidden for the GGPK source, which it does not affect).

Co-Authored-By: Claude Opus 4.8 <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants