aboutsummaryrefslogtreecommitdiff
path: root/engines/gob/inter_v4.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'engines/gob/inter_v4.cpp')
-rw-r--r--engines/gob/inter_v4.cpp103
1 files changed, 97 insertions, 6 deletions
diff --git a/engines/gob/inter_v4.cpp b/engines/gob/inter_v4.cpp
index 76b11752e0..fd90b731a2 100644
--- a/engines/gob/inter_v4.cpp
+++ b/engines/gob/inter_v4.cpp
@@ -29,6 +29,7 @@
#include "gob/gob.h"
#include "gob/inter.h"
#include "gob/global.h"
+#include "gob/draw.h"
#include "gob/game.h"
#include "gob/parse.h"
#include "gob/videoplayer.h"
@@ -279,7 +280,7 @@ void Inter_v4::setupOpcodes() {
{NULL, ""},
{NULL, ""},
/* 80 */
- OPCODE(o2_initScreen),
+ OPCODE(o4_initScreen),
OPCODE(o2_scroll),
OPCODE(o2_setScrollOffset),
OPCODE(o4_playVmdOrMusic),
@@ -504,7 +505,7 @@ void Inter_v4::setupOpcodes() {
/* 30 */
OPCODE(o1_returnTo),
OPCODE(o1_loadSpriteContent),
- OPCODE(o3_copySprite),
+ OPCODE(o1_copySprite),
OPCODE(o1_fillRect),
/* 34 */
OPCODE(o1_drawLine),
@@ -687,6 +688,8 @@ void Inter_v4::executeGoblinOpcode(int i, OpGobParams &params) {
}
if (op == NULL) {
+ warning("unimplemented opcodeGoblin: %d", i);
+
int16 val;
_vm->_global->_inter_execPtr -= 2;
@@ -714,6 +717,86 @@ const char *Inter_v4::getOpcodeGoblinDesc(int i) {
return "";
}
+void Inter_v4::o4_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();
+
+ _vm->_video->clearScreen();
+
+ _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<int16>(_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];
+ }
+}
+
void Inter_v4::o4_playVmdOrMusic() {
char fileName[128];
int16 x, y;
@@ -729,6 +812,12 @@ void Inter_v4::o4_playVmdOrMusic() {
evalExpr(0);
strncpy0(fileName, _vm->_global->_inter_resStr, 127);
+ // WORKAROUND: The nut rolling animation in the administration center
+ // in Woodruff is called "noixroul", but the scripts think it's "noixroule".
+ if ((_vm->getGameType() == kGameTypeWoodruff) &&
+ (!scumm_stricmp(fileName, "noixroule")))
+ strcpy(fileName, "noixroul");
+
x = _vm->_parse->parseValExpr();
y = _vm->_parse->parseValExpr();
startFrame = _vm->_parse->parseValExpr();
@@ -739,11 +828,14 @@ void Inter_v4::o4_playVmdOrMusic() {
palEnd = _vm->_parse->parseValExpr();
palCmd = 1 << (flags & 0x3F);
+ debugC(1, kDebugVideo, "Playing video \"%s\" @ %d+%d, frames %d - %d, "
+ "paletteCmd %d (%d - %d), flags %X", fileName, x, y, startFrame, lastFrame,
+ palCmd, palStart, palEnd, flags);
+
close = false;
if (lastFrame == -1) {
close = true;
} else if (lastFrame == -3) {
-// warning("Woodruff Stub: Video/Music command -3: Play background video %s, %d, %d, %d, %d", fileName, startFrame, x, y, VAR_OFFSET(7872));
_vm->_mult->_objects[startFrame].pAnimData->animation = -startFrame - 1;
@@ -767,17 +859,16 @@ void Inter_v4::o4_playVmdOrMusic() {
warning("Woodruff Stub: Video/Music command -4: Play background video %s", fileName);
return;
} else if (lastFrame == -5) {
-// warning("Woodruff Stub: Video/Music command -5: Stop background music");
_vm->_sound->bgStop();
return;
} else if (lastFrame == -6) {
-// warning("Woodruff Stub: Video/Music command -6: Load background video %s", fileName);
+ return;
+ } else if (lastFrame == -7) {
return;
} else if (lastFrame == -8) {
warning("Woodruff Stub: Video/Music command -8: Play background video %s", fileName);
return;
} else if (lastFrame == -9) {
-// warning("Woodruff Stub: Video/Music command -9: Play background music %s (%d-%d)", fileName, palEnd, palStart);
_vm->_sound->bgStop();
_vm->_sound->bgSetPlayMode(BackgroundAtmosphere::kPlayModeRandom);
_vm->_sound->bgPlay(fileName, palStart);