diff options
author | Björn Steinbrink <B.Steinbrink@gmx.de> | 2005-07-31 15:45:33 +0000 |
---|---|---|
committer | Björn Steinbrink <B.Steinbrink@gmx.de> | 2005-07-31 15:45:33 +0000 |
commit | b7b9299ab765647807f25dc95e8b8cb57f6eb1c5 (patch) | |
tree | 7b9a68497ee4b8d19cddc226803b34172b5149fd /src/engine.cpp | |
parent | 51bfbd368cc455b037393d3383346640113e915b (diff) | |
download | mana-b7b9299ab765647807f25dc95e8b8cb57f6eb1c5.tar.gz mana-b7b9299ab765647807f25dc95e8b8cb57f6eb1c5.tar.bz2 mana-b7b9299ab765647807f25dc95e8b8cb57f6eb1c5.tar.xz mana-b7b9299ab765647807f25dc95e8b8cb57f6eb1c5.zip |
Added check to stop scrolling at map borders. Small cleanup in the listbox drawing code.
Diffstat (limited to 'src/engine.cpp')
-rw-r--r-- | src/engine.cpp | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/engine.cpp b/src/engine.cpp index c6a7a6c8..918aea7f 100644 --- a/src/engine.cpp +++ b/src/engine.cpp @@ -335,6 +335,22 @@ void Engine::draw() map_x = (player_node->x - 13) * 32 + get_x_offset(player_node); map_y = (player_node->y - 9) * 32 + get_y_offset(player_node); + if (map_x < 0) { + map_x = 0; + } + if (map_y < 0) { + map_y = 0; + } + + if (mCurrentMap) { + if (map_x > (mCurrentMap->getWidth() - 13) * 32) { + map_x = (mCurrentMap->getWidth() - 13) * 32; + } + if (map_y > (mCurrentMap->getHeight() - 9) * 32) { + map_y = (mCurrentMap->getHeight() - 9) * 32; + } + } + camera_x = map_x / 32; camera_y = map_y / 32; int mouseTileX = mouseX / 32 + camera_x; |