diff options
author | Ľubomír Remák | 2018-07-15 00:18:54 +0200 |
---|---|---|
committer | Eugene Sandulenko | 2018-08-25 23:12:01 +0200 |
commit | febff83a4edc89e1dbc6f4c56f5531f0eb8f3287 (patch) | |
tree | 756129c1736a39aad5473d7873810a3a742911ae /engines/mutationofjb/room.cpp | |
parent | d2e354b51f637dc2e9b251256b5a017cb41cfe59 (diff) | |
download | scummvm-rg350-febff83a4edc89e1dbc6f4c56f5531f0eb8f3287.tar.gz scummvm-rg350-febff83a4edc89e1dbc6f4c56f5531f0eb8f3287.tar.bz2 scummvm-rg350-febff83a4edc89e1dbc6f4c56f5531f0eb8f3287.zip |
MUTATIONOFJB: Draw objects (first frame only) and improve conversation support.
Diffstat (limited to 'engines/mutationofjb/room.cpp')
-rw-r--r-- | engines/mutationofjb/room.cpp | 31 |
1 files changed, 29 insertions, 2 deletions
diff --git a/engines/mutationofjb/room.cpp b/engines/mutationofjb/room.cpp index 62af98327e..5577077480 100644 --- a/engines/mutationofjb/room.cpp +++ b/engines/mutationofjb/room.cpp @@ -21,17 +21,25 @@ */ #include "mutationofjb/room.h" + #include "mutationofjb/animationdecoder.h" #include "mutationofjb/encryptedfile.h" #include "mutationofjb/game.h" #include "mutationofjb/gamedata.h" #include "mutationofjb/util.h" + #include "common/str.h" #include "common/translation.h" + #include "graphics/screen.h" namespace MutationOfJB { +enum { + GAME_AREA_WIDTH = 320, + GAME_AREA_HEIGHT = 139 +}; + class RoomAnimationDecoderCallback : public AnimationDecoderCallback { public: RoomAnimationDecoderCallback(Room &room) : _room(room) {} @@ -47,9 +55,11 @@ void RoomAnimationDecoderCallback::onPaletteUpdated(byte palette[PALETTE_SIZE]) void RoomAnimationDecoderCallback::onFrame(int frameNo, Graphics::Surface &surface) { if (frameNo == 0) { - Common::Rect rect(0, 0, 320, 139); + Common::Rect rect(0, 0, GAME_AREA_WIDTH, GAME_AREA_HEIGHT); if (_room._game->isCurrentSceneMap()) { rect = Common::Rect(0, 0, 320, 200); + } else { + _room._background.blitFrom(surface, rect, Common::Point(0, 0)); } _room._screen->blitFrom(surface, rect, Common::Point(0, 0)); } @@ -78,10 +88,11 @@ void RoomAnimationDecoderCallback::onFrame(int frameNo, Graphics::Surface &surfa } } -Room::Room(Game *game, Graphics::Screen *screen) : _game(game), _screen(screen) {} +Room::Room(Game *game, Graphics::Screen *screen) : _game(game), _screen(screen), _background(GAME_AREA_WIDTH, GAME_AREA_HEIGHT) {} bool Room::load(uint8 roomNumber, bool roomB) { _objectsStart.clear(); + _surfaces.clear(); // TODO: Fix memory leak. Scene *const scene = _game->getGameData().getCurrentScene(); if (scene) { @@ -118,7 +129,23 @@ void Room::drawObjectAnimation(uint8 objectId, int animOffset) { const int startFrame = _objectsStart[objectId - 1]; const int animFrame = startFrame + animOffset; + // TODO: Threshold. _screen->blitFrom(_surfaces[animFrame], Common::Point(object->_x, object->_y)); } +void Room::redraw() { + if (!_game->isCurrentSceneMap()) { + Common::Rect rect(0, 0, GAME_AREA_WIDTH, GAME_AREA_HEIGHT); + _screen->blitFrom(_background.rawSurface(), rect, Common::Point(0, 0)); + + Scene *const currentScene = _game->getGameData().getCurrentScene(); + for (int i = 0; i < currentScene->getNoObjects(); ++i) { + Object *const obj = currentScene->getObject(i + 1); + if (obj->_AC) { + drawObjectAnimation(i + 1, 0); + } + } + } +} + } |