aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2012-09-15 21:42:20 +1000
committerPaul Gilbert2012-09-15 21:42:20 +1000
commite02e950a40a5abbef9f53569d99b66af6dc30345 (patch)
tree9cb982c666beb6b88fbe40a2b226bbb87cfbcfc7
parentd007e0aafe7932899cdf87d6007bf10ebed1cad6 (diff)
downloadscummvm-rg350-e02e950a40a5abbef9f53569d99b66af6dc30345.tar.gz
scummvm-rg350-e02e950a40a5abbef9f53569d99b66af6dc30345.tar.bz2
scummvm-rg350-e02e950a40a5abbef9f53569d99b66af6dc30345.zip
HOPKINS: Implemented Vbe decoding so introduction now runs
-rw-r--r--engines/hopkins/anim.cpp26
-rw-r--r--engines/hopkins/events.cpp4
-rw-r--r--engines/hopkins/graphics.cpp58
-rw-r--r--engines/hopkins/graphics.h5
-rw-r--r--engines/hopkins/hopkins.cpp6
5 files changed, 83 insertions, 16 deletions
diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp
index 6eadbd413c..325dadcbf9 100644
--- a/engines/hopkins/anim.cpp
+++ b/engines/hopkins/anim.cpp
@@ -50,7 +50,7 @@ void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, ui
doneFlag = 0;
for (;;) {
-MAIN_LOOP:
+//MAIN_LOOP:
v14 = v15 = v16 = v17 = 0;
v18 = 1;
screenP = _vm->_graphicsManager.VESA_SCREEN;
@@ -60,12 +60,15 @@ MAIN_LOOP:
if (!f.open(GLOBALS.NFICHIER))
error("Not Found file %s", GLOBALS.NFICHIER.c_str());
- f.skip(6);
// TODO: Original above read seems to overlap the doneFlag
- //doneFlag = f.readUint16LE() != 0;
- f.read(_vm->_graphicsManager.Palette, 800);
+ f.skip(6);
+ //buf = read(4); doneFlag = f.readUint16LE() != 0;
+ f.read(_vm->_graphicsManager.Palette, PALETTE_EXT_BLOCK_SIZE);
f.skip(4);
nbytes = f.readUint32LE();
+
+ // TODO: Original never seems to do anything with these. Or are these part of
+ // a bigger structure needed for sub-methods?
v19 = f.readUint32LE();
v18 = f.readUint16LE();
v17 = f.readUint16LE();
@@ -119,9 +122,11 @@ MAIN_LOOP:
if (_vm->_eventsManager.ESC_KEY)
goto FINISH;
+// TODO: Original REDRAW_ANIM always returns false, so this isn't needed?
+#if 0
if (REDRAW_ANIM())
goto REDRAW_ANIM;
-
+#endif
_vm->_eventsManager.CONTROLE_MES();
} while (_vm->_eventsManager.lItCounter < rate1);
}
@@ -131,14 +136,13 @@ MAIN_LOOP:
idx = 0;
do {
_vm->_soundManager.PLAY_ANM_SOUND(idx);
- f.skip(6);
// Get in string
Common::fill(&strBuffer[0], &strBuffer[20], 0);
if (f.read(strBuffer, 16) != 16)
doneFlag = true;
- if (strncmp(strBuffer, "IMAGE=", 7) != 0)
+ if (strncmp(strBuffer, "IMAGE=", 6) != 0)
doneFlag = true;
if (!doneFlag) {
@@ -149,6 +153,8 @@ MAIN_LOOP:
if (_vm->_eventsManager.ESC_KEY)
goto FINISH;
+// TODO: Original REDRAW_ANIM always returns false, so this isn't needed?
+#if 0
if (REDRAW_ANIM()) {
if (_vm->_graphicsManager.NOLOCK == 1)
goto FINISH;
@@ -160,6 +166,7 @@ MAIN_LOOP:
screenCopy = GLOBALS.dos_free2(screenCopy);
goto MAIN_LOOP;
}
+#endif
_vm->_eventsManager.CONTROLE_MES();
_vm->_soundManager.VERIF_SOUND();
@@ -200,6 +207,8 @@ MAIN_LOOP:
if (_vm->_eventsManager.ESC_KEY)
goto FINISH;
+// TODO: Original REDRAW_ANIM always returns false, so this isn't needed?
+#if 0
if (REDRAW_ANIM()) {
REDRAW_ANIM:
if (_vm->_graphicsManager.NOLOCK == 1)
@@ -212,6 +221,7 @@ REDRAW_ANIM:
screenCopy = GLOBALS.dos_free2(screenCopy);
goto MAIN_LOOP;
}
+#endif
_vm->_eventsManager.CONTROLE_MES();
_vm->_soundManager.VERIF_SOUND();
@@ -227,7 +237,7 @@ FINISH:
screenCopy = GLOBALS.dos_malloc2(SCREEN_WIDTH * SCREEN_HEIGHT);
f.skip(6);
- f.read(_vm->_graphicsManager.Palette, 800);
+ f.read(_vm->_graphicsManager.Palette, PALETTE_EXT_BLOCK_SIZE);
f.skip(4);
nbytes = f.readUint32LE();
v19 = f.readUint32LE();
diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp
index 279b8ac7b8..f3c913f606 100644
--- a/engines/hopkins/events.cpp
+++ b/engines/hopkins/events.cpp
@@ -118,6 +118,8 @@ void EventsManager::delay(int delay) {
}
void EventsManager::pollEvents() {
+ checkForNextFrameCounter();
+
Common::Event event;
while (g_system->getEventManager()->pollEvent(event)) {
// Handle keypress
@@ -139,8 +141,6 @@ void EventsManager::pollEvents() {
default:
break;
}
-
- checkForNextFrameCounter();
}
}
diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp
index 26907c235e..b02a81123f 100644
--- a/engines/hopkins/graphics.cpp
+++ b/engines/hopkins/graphics.cpp
@@ -898,7 +898,63 @@ void GraphicsManager::Copy_Video_Vbe3(const byte *surface) {
}
void GraphicsManager::Copy_Video_Vbe16(const byte *surface) {
- warning("TODO: Copy_Video_Vbe3");
+ const byte *srcP = surface;
+ int destOffset = 0;
+ assert(VideoPtr);
+
+ for (;;) {
+ byte srcByte = *srcP;
+ if (srcByte >= 222) {
+ if (srcByte == 252)
+ return;
+ if (srcByte < 251) {
+ destOffset += srcByte - 221;
+ srcByte = *++srcP;
+ } else if (srcByte == 253) {
+ destOffset += *(const byte *)(srcP + 1);
+ srcByte = *(const byte *)(srcP + 2);
+ srcP += 2;
+ } else if (srcByte == 254) {
+ destOffset += READ_LE_UINT16(srcP + 1);
+ srcByte = *(const byte *)(srcP + 3);
+ srcP += 3;
+ } else {
+ destOffset += READ_LE_UINT32(srcP + 1);
+ srcByte = *(const byte *)(srcP + 5);
+ srcP += 5;
+ }
+ }
+
+ if (srcByte > 210) {
+ if (srcByte == 211) {
+ int pixelCount = *(srcP + 1);
+ int pixelIndex = *(srcP + 2);
+ uint16 *destP = (uint16 *)((byte *)VideoPtr->pixels + destOffset * 2);
+ uint16 pixelValue = *(uint16 *)(PAL_PIXELS + 2 * pixelIndex);
+ destOffset += pixelCount;
+
+ while (pixelCount--)
+ *destP++ = pixelValue;
+
+ srcP += 3;
+ } else {
+ int pixelCount = srcByte - 211;
+ int pixelIndex = *(srcP + 1);
+ uint16 *destP = (uint16 *)((byte *)VideoPtr->pixels + destOffset * 2);
+ uint16 pixelValue = *(uint16 *)(PAL_PIXELS + 2 * pixelIndex);
+ destOffset += pixelCount;
+
+ while (pixelCount--)
+ *destP++ = pixelValue;
+
+ srcP += 2;
+ }
+ } else {
+ *((uint16 *)VideoPtr->pixels + destOffset) = *(uint16 *)(PAL_PIXELS + 2 * srcByte);
+ ++srcP;
+ ++destOffset;
+ }
+ }
}
void GraphicsManager::FIN_VISU() {
diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h
index 756ae49cbe..6bb8f333b5 100644
--- a/engines/hopkins/graphics.h
+++ b/engines/hopkins/graphics.h
@@ -32,6 +32,7 @@ namespace Hopkins {
#define PALETTE_SIZE 256
#define PALETTE_BLOCK_SIZE (PALETTE_SIZE * 3)
+#define PALETTE_EXT_BLOCK_SIZE 800
struct RGB8 {
byte r;
@@ -55,7 +56,7 @@ public:
int nbrligne;
byte TABLE_COUL[PALETTE_SIZE];
byte cmap[PALETTE_BLOCK_SIZE];
- byte Palette[800];
+ byte Palette[PALETTE_EXT_BLOCK_SIZE];
bool Linear;
Graphics::Surface *VideoPtr;
byte *VESA_SCREEN;
@@ -73,7 +74,7 @@ public:
int Agr_x, Agr_y;
int Agr_Flag_x, Agr_Flag_y;
int FADESPD;
- byte PALPCX[800];
+ byte PALPCX[PALETTE_EXT_BLOCK_SIZE];
int FADE_LINUX;
bool NOLOCK;
int no_scroll;
diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp
index 0cfb263972..c01b3b1cba 100644
--- a/engines/hopkins/hopkins.cpp
+++ b/engines/hopkins/hopkins.cpp
@@ -618,10 +618,10 @@ void HopkinsEngine::INTRORUN() {
__int16 v21;
char v22;
char v23;
- byte paletteData[800];
- byte paletteData2[800];
+ byte paletteData[PALETTE_EXT_BLOCK_SIZE];
+ byte paletteData2[PALETTE_EXT_BLOCK_SIZE];
- memset(&paletteData, 0, 800);
+ memset(&paletteData, 0, PALETTE_EXT_BLOCK_SIZE);
_eventsManager.VBL();
_eventsManager.souris_flag = 0;
_globals.iRegul = 1;