Heroes of Might and Magic 1 Reverse Engineering — Castle Screen UI: Sprites, Offsets & Click Bugs
2026 · Mobile Game · Mobile Game
Heroes of Might and Magic 1 Reverse Engineering — Castle Screen UI: Sprites, Offsets & Click Bugs
Heroes of Might and Magic 1 Reverse Engineering — Castle Screen UI: Sprites, Offsets & Click Bugs
2026
Mobile Game
In this episode, we continue reverse engineering Heroes of Might and Magic 1 by building out the castle screen from scratch in C++. We start by exploring the game's asset structure — ICN files, strip icons, town background images, and how the castle screen layers multiple sprites together, including the hero portrait, hero crest, garrison creatures, and resource display. Using the existing hero screen as a reference, we feed the AI a detailed spec and get a first working build up quickly. From there, the bulk of the video is hands-on debugging: fixing a misaligned hero portrait, manually tweaking pixel offsets for the garrison rows, crest, name bar, and exit button through iterative recompilation. We also track down and fix a castle click bug — a keyboard scroll guard and castle click guard were blocking the castle entrance interaction — and then resolve a faction index bug where the wrong castle background was being displayed for certain hero factions (e.g., a sorceress hero showing a barbarian castle). The fix involves remapping the faction index values at runtime. By the end, the castle screen is functional: clickable from the map, showing the correct town background per faction, hero portrait, crest, garrison creatures, and resource layout — all reasonably aligned. If you know any HoMM1 castle names or hero short names, drop them in the comments!