From ebf2948e9a7435dfe409f1c16c29165f06dd8b4b Mon Sep 17 00:00:00 2001 From: Sven Hesse Date: Thu, 4 Dec 2008 00:52:12 +0000 Subject: Last Dynasty video mode switching (and removing a debug output) svn-id: r35231 --- engines/gob/coktelvideo.cpp | 3 -- engines/gob/inter.h | 1 + engines/gob/inter_v5.cpp | 103 +++++++++++++++++++++++++++++++++++++++++++- 3 files changed, 103 insertions(+), 4 deletions(-) diff --git a/engines/gob/coktelvideo.cpp b/engines/gob/coktelvideo.cpp index 6dd8e8c7b0..be274ef6d3 100644 --- a/engines/gob/coktelvideo.cpp +++ b/engines/gob/coktelvideo.cpp @@ -1067,9 +1067,6 @@ bool Vmd::load(Common::SeekableReadStream &stream) { if ((((uint32) data.realSize) >= ssize) || (data.name[0] == 0)) continue; - warning("ExtraData %d: %d.%d, %d, %d, %d, %s", _extraData.size(), i, j, - data.offset, data.size, data.realSize, data.name); - _extraData.push_back(data); } else diff --git a/engines/gob/inter.h b/engines/gob/inter.h index fe31722c6c..3ea8688bc3 100644 --- a/engines/gob/inter.h +++ b/engines/gob/inter.h @@ -566,6 +566,7 @@ protected: byte _byte_8AA14; void o5_deleteFile(); + void o5_initScreen(); bool o5_istrlen(OpFuncParams ¶ms); diff --git a/engines/gob/inter_v5.cpp b/engines/gob/inter_v5.cpp index acead4ac55..58ded12434 100644 --- a/engines/gob/inter_v5.cpp +++ b/engines/gob/inter_v5.cpp @@ -234,7 +234,7 @@ void Inter_v5::setupOpcodes() { {NULL, ""}, {NULL, ""}, /* 80 */ - OPCODE(o4_initScreen), + OPCODE(o5_initScreen), OPCODE(o2_scroll), OPCODE(o2_setScrollOffset), OPCODE(o4_playVmdOrMusic), @@ -678,6 +678,107 @@ void Inter_v5::o5_deleteFile() { warning("Dynasty Stub: deleteFile \"%s\"", _vm->_global->_inter_resStr); } +void Inter_v5::o5_initScreen() { + int16 offY; + int16 videoMode; + int16 width, height; + + offY = load16(); + + videoMode = offY & 0xFF; + offY = (offY >> 8) & 0xFF; + + width = _vm->_parse->parseValExpr(); + height = _vm->_parse->parseValExpr(); + + warning("initScreen: %d, %d, %d, %d", width, height, offY, videoMode); + + _vm->_video->clearScreen(); + + if (videoMode == 0x13) { + + if (width == -1) + width = 320; + if (height == -1) + height = 200; + + _vm->_width = 320; + _vm->_height = 200; + + _vm->_video->setSize(false); + + } else if (_vm->_global->_videoMode == 0x13) { + width = _vm->_width = 640; + height = _vm->_height = 480; + + _vm->_video->setSize(true); + } + + _vm->_global->_fakeVideoMode = videoMode; + + // Some versions require this + if (videoMode == 0xD) + videoMode = _vm->_mode; + + if ((videoMode == _vm->_global->_videoMode) && (width == -1)) + return; + + if (width > 0) + _vm->_video->_surfWidth = width; + if (height > 0) + _vm->_video->_surfHeight = height; + + _vm->_video->_screenDeltaX = 0; + if (_vm->_video->_surfWidth < _vm->_width) + _vm->_video->_screenDeltaX = (_vm->_width - _vm->_video->_surfWidth) / 2; + + _vm->_global->_mouseMinX = _vm->_video->_screenDeltaX; + _vm->_global->_mouseMaxX = _vm->_video->_screenDeltaX + _vm->_video->_surfWidth - 1; + + _vm->_video->_splitStart = _vm->_video->_surfHeight - offY; + + _vm->_video->_splitHeight1 = MIN(_vm->_height, _vm->_video->_surfHeight); + _vm->_video->_splitHeight2 = offY; + + if ((_vm->_video->_surfHeight + offY) < _vm->_height) + _vm->_video->_screenDeltaY = (_vm->_height - (_vm->_video->_surfHeight + offY)) / 2; + else + _vm->_video->_screenDeltaY = 0; + + _vm->_global->_mouseMaxY = (_vm->_video->_surfHeight + _vm->_video->_screenDeltaY) - offY - 1; + _vm->_global->_mouseMinY = _vm->_video->_screenDeltaY; + + _vm->_draw->closeScreen(); + _vm->_util->clearPalette(); + memset(_vm->_global->_redPalette, 0, 256); + memset(_vm->_global->_greenPalette, 0, 256); + memset(_vm->_global->_bluePalette, 0, 256); + + _vm->_video->_splitSurf = 0; + _vm->_draw->_spritesArray[24] = 0; + _vm->_draw->_spritesArray[25] = 0; + + _vm->_global->_videoMode = videoMode; + _vm->_video->initPrimary(videoMode); + WRITE_VAR(15, _vm->_global->_fakeVideoMode); + + _vm->_global->_setAllPalette = true; + + _vm->_util->setMousePos(_vm->_global->_inter_mouseX, + _vm->_global->_inter_mouseY); + _vm->_util->clearPalette(); + + _vm->_draw->initScreen(); + + _vm->_util->setScrollOffset(); + + if (offY > 0) { + _vm->_draw->_spritesArray[24] = new SurfaceDesc(videoMode, _vm->_width, offY); + _vm->_draw->_spritesArray[25] = new SurfaceDesc(videoMode, _vm->_width, offY); + _vm->_video->_splitSurf = _vm->_draw->_spritesArray[25]; + } +} + bool Inter_v5::o5_istrlen(OpFuncParams ¶ms) { int16 strVar1, strVar2; int16 len; -- cgit v1.2.3