Good news for those of you who are waiting for Modern Dungeon Romp. I have found the bug that was causing the game to stall. Now, those of you who don't care about technical explanations can stop reading with the knowledge that next week's release will be Modern Dungeon Romp. Anybody still reading? Didn't think so, but I will continue with this post for my own records.
The big change that I made was to hide the map then as the player explored the dungeon, the map would be revealed. This was something that I had originally planned for the classic version of the game, but decided not to do this as the game took quite a long time to play even with the entire map revealed. My plan was to just have a bit within the map tile information to be set if a tile was known. As the player moves through the dungeon, the flags for all the tiles around the player get set. As this is actually stored in the tile information, the actual tile value is not the number that is stored in the map array but a masked version of that tile. This functionality existed even in the classic version but the setting of the flag was simply not implemented.
This change should not have had anything to do with the stall, but it did. While the official getTile function properly masked the bits so only the tile value was returned, the function that spawns new monsters did not use the getTile function but accessed the map data directly. This function randomly looked for an empty tile to place the monster into. When a player had seen a tile, it was no longer empty, as the seen flag changed the value from 0 to 64, even though after applying the tile mask the value would be 0. The solution was simply to have the spawn function use the getTile function instead of accessing the map data directly. This is slightly slower, but as speed is not an issue (which is a good thing as the techniques I used for items and monsters are very inefficient) it is a simple way of making sure the data I am looking for is correct.
So what was causing the game to stall was the monster spawning trying to spawn a monster but not being able to randomly select a tile that was empty because it didn't consider locations that had been seen by the player as empty. If the map was fully explored, which is usually the case when I am playing a game, then the game would go into an infinite loop as it searched for a empty tile.