Fix segfault when Link is thrown into prison

`guard:stop_movement()` deletes the entity's movement, but
`guard:set_position()` (`NPC::notify_position_changed()` in the engine)
assumes it is non-nil when the current animation is "walking".

I don't know what the proper fix is, but simply delaying the stop_movement
seems to work.
Ancient Castle fixes

This fixes the puzzles, but the boss fight is still very buggy.
Mystic Mirror fix
Fix Inferno river maze
Fix various local functions that are referenced before being declared
Potion shop fix
Inferno fixes
Add missing direction parameter for map:create_enemy
Merge pull request #43 from pdewacht/master

Fixes mostly for the Ancient Castle and Inferno dungeons