diff options
author | Eugene Sandulenko | 2013-07-25 15:43:10 +0300 |
---|---|---|
committer | Eugene Sandulenko | 2013-09-06 14:51:05 +0300 |
commit | aaf5bae026416e158d69633eb1b07c73a63fcccd (patch) | |
tree | 85b3142f8841c0502c11420363e1e379a5ba8a35 | |
parent | dbe5524fe036e51ebaafa900ce237b85e79020e8 (diff) | |
download | scummvm-rg350-aaf5bae026416e158d69633eb1b07c73a63fcccd.tar.gz scummvm-rg350-aaf5bae026416e158d69633eb1b07c73a63fcccd.tar.bz2 scummvm-rg350-aaf5bae026416e158d69633eb1b07c73a63fcccd.zip |
FULLPIPE: Fixed initial scene drawing. Scene bg is shown
-rw-r--r-- | engines/fullpipe/fullpipe.cpp | 34 | ||||
-rw-r--r-- | engines/fullpipe/gameloader.cpp | 26 | ||||
-rw-r--r-- | engines/fullpipe/gameloader.h | 2 | ||||
-rw-r--r-- | engines/fullpipe/gfx.cpp | 60 | ||||
-rw-r--r-- | engines/fullpipe/scene.cpp | 17 |
5 files changed, 104 insertions, 35 deletions
diff --git a/engines/fullpipe/fullpipe.cpp b/engines/fullpipe/fullpipe.cpp index 2e0444417c..de4da66f3a 100644 --- a/engines/fullpipe/fullpipe.cpp +++ b/engines/fullpipe/fullpipe.cpp @@ -110,16 +110,44 @@ Common::Error FullpipeEngine::run() { ent._sceneId = 3896; sceneSwitcher(&ent); + _currentScene->draw(); + while (!g_fullpipe->_needQuit) { updateEvents(); _system->delayMillis(10); _system->updateScreen(); - _currentScene->draw(); - - if (g_fullpipe->_keyState == ' ') { + switch (g_fullpipe->_keyState) { + case Common::KEYCODE_q: + g_fullpipe->_needQuit = true; + break; + case Common::KEYCODE_UP: + _sceneRect.moveTo(_sceneRect.left, _sceneRect.top + 10); + _currentScene->draw(); + g_fullpipe->_keyState = Common::KEYCODE_INVALID; + break; + case Common::KEYCODE_DOWN: + _sceneRect.moveTo(_sceneRect.left, _sceneRect.top - 10); + _currentScene->draw(); + g_fullpipe->_keyState = Common::KEYCODE_INVALID; + break; + case Common::KEYCODE_LEFT: + _sceneRect.moveTo(_sceneRect.left + 10, _sceneRect.top); + _currentScene->draw(); g_fullpipe->_keyState = Common::KEYCODE_INVALID; break; + case Common::KEYCODE_RIGHT: + _sceneRect.moveTo(_sceneRect.left - 10, _sceneRect.top); + _currentScene->draw(); + g_fullpipe->_keyState = Common::KEYCODE_INVALID; + break; + case Common::KEYCODE_z: + _sceneRect.moveTo(0, 0); + _currentScene->draw(); + g_fullpipe->_keyState = Common::KEYCODE_INVALID; + break; + default: + break; } } diff --git a/engines/fullpipe/gameloader.cpp b/engines/fullpipe/gameloader.cpp index c7b547d845..675839f9a6 100644 --- a/engines/fullpipe/gameloader.cpp +++ b/engines/fullpipe/gameloader.cpp @@ -129,10 +129,13 @@ bool CGameLoader::load(MfcArchive &file) { return true; } -bool CGameLoader::loadScene(int num) { +bool CGameLoader::loadScene(int sceneId) { SceneTag *st; - int idx = getSceneTagBySceneId(num, &st); + int idx = getSceneTagBySceneId(sceneId, &st); + + if (idx < 0) + return false; if (st->_scene) st->loadScene(); @@ -152,10 +155,23 @@ bool CGameLoader::loadScene(int num) { return false; } -int CGameLoader::getSceneTagBySceneId(int num, SceneTag **st) { - warning("STUB: CGameLoader::getSceneTagBySceneId()"); +int CGameLoader::getSceneTagBySceneId(int sceneId, SceneTag **st) { + if (_sc2array.size() > 0 && _gameProject->_sceneTagList->size() > 0) { + for (uint i = 0; i < _sc2array.size(); i++) { + if (_sc2array[i]._sceneId == sceneId) { + int num = 0; + for (SceneTagList::iterator s = _gameProject->_sceneTagList->begin(); s != _gameProject->_sceneTagList->end(); ++s, num++) { + if (s->_sceneId == sceneId) { + *st = &(*s); + return num; + } + } + } + } + } - return 0; + *st = 0; + return -1; } void CGameLoader::applyPicAniInfos(Scene *sc, PicAniInfo **picAniInfo, int picAniInfoCount) { diff --git a/engines/fullpipe/gameloader.h b/engines/fullpipe/gameloader.h index ce933cb000..3a96a53d6f 100644 --- a/engines/fullpipe/gameloader.h +++ b/engines/fullpipe/gameloader.h @@ -40,7 +40,7 @@ class CGameLoader : public CObject { virtual bool load(MfcArchive &file); bool loadScene(int num); - int getSceneTagBySceneId(int num, SceneTag **st); + int getSceneTagBySceneId(int sceneId, SceneTag **st); void applyPicAniInfos(Scene *sc, PicAniInfo **picAniInfo, int picAniInfoCount); GameProject *_gameProject; diff --git a/engines/fullpipe/gfx.cpp b/engines/fullpipe/gfx.cpp index fb9466177c..1e1f1b554f 100644 --- a/engines/fullpipe/gfx.cpp +++ b/engines/fullpipe/gfx.cpp @@ -249,6 +249,8 @@ bool Picture::load(MfcArchive &file) { file.read(_paletteData, 1024); } + getData(); + debug(5, "Picture::load: <%s>", _memfilename); #if 0 @@ -318,6 +320,8 @@ void Picture::draw(int x, int y, int style, int angle) { int x1 = x; int y1 = y; + debug(0, "Picture::draw(%d, %d, %d, %d)", x, y, style, angle); + if (x != -1) x1 = x; @@ -387,6 +391,8 @@ void Picture::displayPicture() { } void Bitmap::putDib(int x, int y, int32 *palette) { + debug(0, "Bitmap::putDib(%d, %d)", x, y); + _x = x - g_fullpipe->_sceneRect.left; _y = y - g_fullpipe->_sceneRect.top; @@ -408,10 +414,12 @@ void Bitmap::putDibRB(int32 *palette) { uint16 *srcPtr2; uint16 *srcPtr; + debug(0, "Bitmap::putDibRB()"); + endx = _width + _x - 1; endy = _height + _y - 1; - if (_x > 799 || _width + _x - 1 < 0 || _y > 599 || endy < 0) + if (_x > 799 || endx < 0 || _y > 599 || endy < 0) return; if (endy > 599) @@ -420,12 +428,20 @@ void Bitmap::putDibRB(int32 *palette) { if (endx > 799) endx = 799; + int startx = _x; + if (startx < 0) + startx = 0; + + int starty = _y; + if (starty < 0) + starty = 0; + y = endy; srcPtr = (uint16 *)_pixels; bool breakup = false; - for (y = endy; y >= _y && !breakup; y--) { - x = _x; + for (y = endy; y >= starty && !breakup; y--) { + x = startx; while ((pixel = *srcPtr++) != 0) { if (pixel == 0x100) { @@ -433,7 +449,7 @@ void Bitmap::putDibRB(int32 *palette) { break; } - while (pixel == 0x200 && y >= _y) { + while (pixel == 0x200 && y >= starty) { uint16 value = *srcPtr++; x += (byte)(value & 0xff); @@ -442,7 +458,7 @@ void Bitmap::putDibRB(int32 *palette) { pixel = *srcPtr++; } - if (y < _y || pixel == 0) + if (y < starty || pixel == 0) break; start1 = x; @@ -495,7 +511,7 @@ void Bitmap::putDibRB(int32 *palette) { } } - g_fullpipe->_system->copyRectToScreen(g_fullpipe->_backgroundSurface.getBasePtr(_x, _y), g_fullpipe->_backgroundSurface.pitch, _x, _y, endx + 1, endy + 1); + g_fullpipe->_system->copyRectToScreen(g_fullpipe->_backgroundSurface.getBasePtr(startx, starty), g_fullpipe->_backgroundSurface.pitch, startx, starty, endx + 1, endy + 1); } void Bitmap::putDibCB(int32 *palette) { @@ -505,13 +521,13 @@ void Bitmap::putDibCB(int32 *palette) { int bpp; uint pitch; bool cb05_format; - byte *srcPtr; - int start; endx = _width + _x - 1; endy = _height + _y - 1; - if (_x > 799 || _width + _x - 1 < 0 || _y > 599 || endy < 0) + debug(0, "Bitmap::putDibCB(): %d, %d, %d, %d [%d, %d]", _x, _y, endx, endy, _width, _height); + + if (_x > 799 || endx < 0 || _y > 599 || endy < 0) return; if (endy > 599) @@ -525,27 +541,31 @@ void Bitmap::putDibCB(int32 *palette) { bpp = cb05_format ? 2 : 1; pitch = (bpp * _width + 3) & 0xFFFFFFFC; - srcPtr = &_pixels[pitch * (endy - _y)]; + byte *srcPtr = &_pixels[pitch * (endy - _y)]; - start = _x; - if (_x < 0) { + int startx = _x; + if (startx < 0) { srcPtr += bpp * -_x; - start = 0; + startx = 0; } + int starty = _y; + if (starty < 0) + starty = 0; + if (_flags & 0x1000000) { - for (int y = _y; y < endy; srcPtr -= pitch, y++) { - curDestPtr = (uint16 *)g_fullpipe->_backgroundSurface.getBasePtr(start, y); - copierKeyColor(curDestPtr, srcPtr, endx - start + 1, _flags & 0xff, (int32 *)palette, cb05_format); + for (int y = starty; y < endy; srcPtr -= pitch, y++) { + curDestPtr = (uint16 *)g_fullpipe->_backgroundSurface.getBasePtr(startx, y); + copierKeyColor(curDestPtr, srcPtr, endx - startx + 1, _flags & 0xff, (int32 *)palette, cb05_format); } } else { - for (int y = _y; y <= endy; srcPtr -= pitch, y++) { - curDestPtr = (uint16 *)g_fullpipe->_backgroundSurface.getBasePtr(start, y); - copier(curDestPtr, srcPtr, endx - start + 1, (int32 *)palette, cb05_format); + for (int y = starty; y <= endy; srcPtr -= pitch, y++) { + curDestPtr = (uint16 *)g_fullpipe->_backgroundSurface.getBasePtr(startx, y); + copier(curDestPtr, srcPtr, endx - startx + 1, (int32 *)palette, cb05_format); } } - g_fullpipe->_system->copyRectToScreen(g_fullpipe->_backgroundSurface.getBasePtr(start, _y), g_fullpipe->_backgroundSurface.pitch, start, _y, endx, endy); + g_fullpipe->_system->copyRectToScreen(g_fullpipe->_backgroundSurface.getBasePtr(startx, starty), g_fullpipe->_backgroundSurface.pitch, startx, starty, endx + 1, endy + 1); } void Bitmap::colorFill(uint16 *dest, int len, int32 color) { diff --git a/engines/fullpipe/scene.cpp b/engines/fullpipe/scene.cpp index 87ef2bd562..78d38a7943 100644 --- a/engines/fullpipe/scene.cpp +++ b/engines/fullpipe/scene.cpp @@ -266,7 +266,7 @@ StaticANIObject *Scene::getAniMan() { StaticANIObject *Scene::getStaticANIObject1ById(int obj, int a3) { for (CPtrList::iterator s = _staticANIObjectList1.begin(); s != _staticANIObjectList1.end(); ++s) { - StaticANIObject *o = (StaticANIObject *)s; + StaticANIObject *o = (StaticANIObject *)*s; if (o->_id == obj && (a3 == -1 || o->_field_4 == a3)) return o; } @@ -276,7 +276,7 @@ StaticANIObject *Scene::getStaticANIObject1ById(int obj, int a3) { StaticANIObject *Scene::getStaticANIObject1ByName(char *name, int a3) { for (CPtrList::iterator s = _staticANIObjectList1.begin(); s != _staticANIObjectList1.end(); ++s) { - StaticANIObject *o = (StaticANIObject *)s; + StaticANIObject *o = (StaticANIObject *)*s; if (!strcmp(o->_objectName, name) && (a3 == -1 || o->_field_4 == a3)) return o; } @@ -375,15 +375,15 @@ void Scene::draw() { objectList_sortByPriority(_staticANIObjectList2); for (CPtrList::iterator s = _staticANIObjectList2.begin(); s != _staticANIObjectList2.end(); ++s) { - ((StaticANIObject *)s)->draw2(); + ((StaticANIObject *)*s)->draw2(); } int priority = -1; for (CPtrList::iterator s = _staticANIObjectList2.begin(); s != _staticANIObjectList2.end(); ++s) { drawContent(((StaticANIObject *)s)->_priority, priority, false); - ((StaticANIObject *)s)->draw(); + ((StaticANIObject *)*s)->draw(); - priority = ((StaticANIObject *)s)->_priority; + priority = ((StaticANIObject *)*s)->_priority; } drawContent(-1, priority, false); @@ -411,6 +411,7 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) { if (maxPri == -1) maxPri = 60000; + debug(0, "_bigPict: %d objlist: %d", _bigPictureArray1Count, _picObjList.size()); if (drawBg && _bigPictureArray1Count && _picObjList.size()) { Common::Point point; @@ -419,8 +420,12 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) { int width = point.x; int height = point.y; + debug(0, "w: %d h:%d", width, height); + ((PictureObject *)_picObjList[0])->getDimensions(&point); + debug(0, "w2: %d h2:%d", point.x, point.y); + int bgStX = g_fullpipe->_sceneRect.left % point.x; if (bgStX < 0) @@ -444,7 +449,7 @@ void Scene::drawContent(int minPri, int maxPri, bool drawBg) { int v51 = height * bgNumY; while (1) { int v25 = bgNumY; - for (int y = g_fullpipe->_sceneRect.top - point.y; y < g_fullpipe->_sceneRect.bottom - 1; ) { + for (int y = g_fullpipe->_sceneRect.top - bgOffsetY; y < g_fullpipe->_sceneRect.bottom - 1; ) { BigPicture *v27 = _bigPictureArray[bgNumX][v25]; v27->draw(bgPosX, y, 0, 0); y += v27->getDimensions(&point)->y; |