From c61ccb031956a61e8bb5804f267e945032989fcb Mon Sep 17 00:00:00 2001 From: lukaslw Date: Thu, 5 Jun 2014 16:42:33 +0200 Subject: PRINCE: hotspot() - name of mobs in wider locations fix, clean up --- engines/prince/graphics.cpp | 2 +- engines/prince/prince.cpp | 33 +++++---------------------------- engines/prince/prince.h | 4 ---- 3 files changed, 6 insertions(+), 33 deletions(-) (limited to 'engines') diff --git a/engines/prince/graphics.cpp b/engines/prince/graphics.cpp index bc15faf9a9..210b9d9ef9 100644 --- a/engines/prince/graphics.cpp +++ b/engines/prince/graphics.cpp @@ -116,7 +116,7 @@ void GraphicsMan::drawMask(Graphics::Surface *frontScreen, DrawNode *drawNode) { if ((drawNode->data[tempMaskPostion] & maskCounter) != 0) { byte orgPixel = *((byte*)drawNode->originalRoomSurface->getBasePtr(x + drawNode->posX, y + drawNode->posY)); *((byte*)frontScreen->getBasePtr(x + drawNode->posX, y + drawNode->posY)) = orgPixel; - //*((byte*)frontScreen->getBasePtr(x + posX, y + posY)) = 0; // for debugging + //*((byte*)frontScreen->getBasePtr(x + drawNode->posX, y + drawNode->posY)) = 0; // for debugging } } } diff --git a/engines/prince/prince.cpp b/engines/prince/prince.cpp index ac7bde8f62..529e17d7fd 100644 --- a/engines/prince/prince.cpp +++ b/engines/prince/prince.cpp @@ -77,7 +77,7 @@ void PrinceEngine::debugEngine(const char *s, ...) { PrinceEngine::PrinceEngine(OSystem *syst, const PrinceGameDescription *gameDesc) : Engine(syst), _gameDescription(gameDesc), _graph(nullptr), _script(nullptr), _interpreter(nullptr), _flags(nullptr), _locationNr(0), _debugger(nullptr), _midiPlayer(nullptr), _room(nullptr), testAnimNr(0), testAnimFrame(0), - _cameraX(0), _newCameraX(0), _frameNr(0), _cursor1(nullptr), _cursor2(nullptr), _font(nullptr), + _frameNr(0), _cursor1(nullptr), _cursor2(nullptr), _font(nullptr), _suitcaseBmp(nullptr), _roomBmp(nullptr), _cursorNr(0), _picWindowX(0), _picWindowY(0), _randomSource("prince") { // Debug/console setup @@ -279,9 +279,7 @@ bool PrinceEngine::loadLocation(uint16 locationNr) { _locationNr = locationNr; _debugger->_locationNr = locationNr; - _cameraX = 0; - _newCameraX = 0; - + _flags->setFlagValue(Flags::CURRROOM, _locationNr); _interpreter->stopBg(); @@ -544,24 +542,6 @@ bool PrinceEngine::loadShadow(byte *shadowBitmap, uint32 dataSize, const char *r return true; } -void PrinceEngine::scrollCameraLeft(int16 delta) { - if (_newCameraX > 0) { - if (_newCameraX < delta) - _newCameraX = 0; - else - _newCameraX -= delta; - } -} - -void PrinceEngine::scrollCameraRight(int16 delta) { - if (_newCameraX != _sceneWidth - 640) { - if (_sceneWidth - 640 < delta + _newCameraX) - delta += (_sceneWidth - 640) - (delta + _newCameraX); - _newCameraX += delta; - debugEngine("PrinceEngine::scrollCameraRight() _newCameraX = %d; delta = %d", _newCameraX, delta); - } -} - void PrinceEngine::keyHandler(Common::Event event) { uint16 nChar = event.kbd.keycode; switch (nChar) { @@ -571,14 +551,12 @@ void PrinceEngine::keyHandler(Common::Event event) { } break; case Common::KEYCODE_LEFT: - scrollCameraLeft(32); if(testAnimNr > 0) { testAnimNr--; } debug("testAnimNr: %d", testAnimNr); break; case Common::KEYCODE_RIGHT: - scrollCameraRight(32); testAnimNr++; debug("testAnimNr: %d", testAnimNr); break; @@ -652,7 +630,7 @@ void PrinceEngine::keyHandler(Common::Event event) { void PrinceEngine::hotspot() { Common::Point mousepos = _system->getEventManager()->getMousePos(); - Common::Point mousePosCamera(mousepos.x + _cameraX, mousepos.y); + Common::Point mousePosCamera(mousepos.x + _picWindowX, mousepos.y); for (Common::Array::const_iterator it = _mobList.begin(); it != _mobList.end() ; it++) { const Mob& mob = *it; @@ -1272,9 +1250,8 @@ void PrinceEngine::mainLoop() { // Ensure non-negative delay = delay < 0 ? 0 : delay; _system->delayMillis(delay); - - _cameraX = _newCameraX; - ++_frameNr; + + _frameNr++; if (_debugger->_locationNr != _locationNr) loadLocation(_debugger->_locationNr); diff --git a/engines/prince/prince.h b/engines/prince/prince.h index f888d9bb6b..41281dc64e 100644 --- a/engines/prince/prince.h +++ b/engines/prince/prince.h @@ -245,8 +245,6 @@ public: Hero *_mainHero; Hero *_secondHero; - uint16 _cameraX; - uint16 _newCameraX; uint16 _sceneWidth; int32 _picWindowX; int32 _picWindowY; @@ -274,8 +272,6 @@ private: bool playNextFrame(); void keyHandler(Common::Event event); void hotspot(); - void scrollCameraRight(int16 delta); - void scrollCameraLeft(int16 delta); void drawScreen(); void showTexts(); void init(); -- cgit v1.2.3