aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/hopkins/anim.cpp285
-rw-r--r--engines/hopkins/anim.h50
-rw-r--r--engines/hopkins/events.cpp63
-rw-r--r--engines/hopkins/events.h15
-rw-r--r--engines/hopkins/globals.cpp2
-rw-r--r--engines/hopkins/globals.h1
-rw-r--r--engines/hopkins/graphics.cpp59
-rw-r--r--engines/hopkins/graphics.h12
-rw-r--r--engines/hopkins/hopkins.cpp55
-rw-r--r--engines/hopkins/hopkins.h9
-rw-r--r--engines/hopkins/module.mk1
-rw-r--r--engines/hopkins/sound.cpp16
-rw-r--r--engines/hopkins/sound.h11
13 files changed, 516 insertions, 63 deletions
diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp
new file mode 100644
index 0000000000..f7e4df4c76
--- /dev/null
+++ b/engines/hopkins/anim.cpp
@@ -0,0 +1,285 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "common/system.h"
+#include "graphics/palette.h"
+#include "common/file.h"
+#include "common/rect.h"
+#include "engines/util.h"
+#include "hopkins/anim.h"
+#include "hopkins/files.h"
+#include "hopkins/globals.h"
+#include "hopkins/graphics.h"
+#include "hopkins/hopkins.h"
+
+namespace Hopkins {
+
+AnimationManager::AnimationManager() {
+ CLS_ANM = false;
+ NO_SEQ = false;
+}
+
+void AnimationManager::PLAY_ANM(const Common::String &filename, uint32 rate1, uint32 rate2, uint32 rate3) {
+ int doneFlag;
+ byte *screenCopy = NULL;
+ uint16 v14, v15, v16, v17, v18, v19;
+ size_t nbytes;
+ byte *screenP;
+ Common::File f;
+ char strBuffer[20];
+ int idx = 0;
+
+ doneFlag = 0;
+ for (;;) {
+MAIN_LOOP:
+ v15 = 0;
+ v14 = 0;
+ v17 = 0;
+ v16 = 0;
+ v18 = 1;
+ screenP = _vm->_graphicsManager.VESA_SCREEN;
+
+ FileManager::CONSTRUIT_FICHIER(GLOBALS.HOPANM, filename);
+
+ 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(4);
+ nbytes = f.readUint32LE();
+ v19 = f.readUint32LE();
+ v18 = f.readUint16LE();
+ v17 = f.readUint16LE();
+ v16 = f.readUint16LE();
+ v15 = f.readUint16LE();
+ v14 = f.readUint16LE();
+
+ f.read(screenP, nbytes);
+
+ if (CLS_ANM) {
+ _vm->_graphicsManager.DD_Lock();
+ _vm->_graphicsManager.Cls_Video();
+ _vm->_graphicsManager.DD_Unlock();
+ }
+
+ if (_vm->_graphicsManager.WinScan / _vm->_graphicsManager.Winbpp > SCREEN_WIDTH) {
+ doneFlag = 1;
+ screenCopy = GLOBALS.dos_malloc2(SCREEN_WIDTH * SCREEN_HEIGHT);
+ memcpy((void *)screenCopy, screenP, SCREEN_WIDTH * SCREEN_HEIGHT);
+ }
+
+ if (NO_SEQ) {
+ if (doneFlag == 1)
+ memcpy((void *)screenCopy, _vm->_graphicsManager.VESA_BUFFER, SCREEN_WIDTH * SCREEN_HEIGHT);
+ _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette);
+ } else {
+ _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette);
+ _vm->_graphicsManager.DD_Lock();
+
+ if (_vm->_graphicsManager.Winbpp == 2) {
+ if (doneFlag)
+ _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, 640, 480, 0, 0);
+ else
+ _vm->_graphicsManager.m_scroll16(screenP, 0, 0, 640, 480, 0, 0);
+ }
+ if (_vm->_graphicsManager.Winbpp == 1) {
+ if (doneFlag)
+ _vm->_graphicsManager.m_scroll2A(screenCopy, 0, 0, 640, 480, 0, 0);
+ else
+ _vm->_graphicsManager.m_scroll2(screenP, 0, 0, 640, 480, 0, 0);
+ }
+ _vm->_graphicsManager.DD_Unlock();
+ _vm->_graphicsManager.DD_VBL();
+ }
+
+ _vm->_eventsManager.lItCounter = 0;
+ _vm->_eventsManager.ESC_KEY = 0;
+ _vm->_soundManager.LOAD_ANM_SOUND();
+ if (_vm->_globals.iRegul == 1) {
+ do {
+ if (_vm->_eventsManager.ESC_KEY)
+ goto FINISH;
+
+ if (REDRAW_ANIM())
+ goto REDRAW_ANIM;
+
+ _vm->_eventsManager.CONTROLE_MES();
+ } while (_vm->_eventsManager.lItCounter < rate1);
+ }
+
+ _vm->_eventsManager.lItCounter = 0;
+ doneFlag = false;
+ 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)
+ doneFlag = true;
+
+ if (!doneFlag) {
+ f.read(screenP, READ_LE_UINT32(strBuffer + 8));
+
+ if (_vm->_globals.iRegul == 1) {
+ do {
+ if (_vm->_eventsManager.ESC_KEY)
+ goto FINISH;
+
+ if (REDRAW_ANIM()) {
+ if (_vm->_graphicsManager.NOLOCK == 1)
+ goto FINISH;
+
+ f.close();
+ if (doneFlag <= SCREEN_WIDTH)
+ goto MAIN_LOOP;
+
+ screenCopy = GLOBALS.dos_free2(screenCopy);
+ goto MAIN_LOOP;
+ }
+
+ _vm->_eventsManager.CONTROLE_MES();
+ _vm->_soundManager.VERIF_SOUND();
+ } while (_vm->_eventsManager.lItCounter < rate2);
+ }
+
+ _vm->_eventsManager.lItCounter = 0;
+ _vm->_graphicsManager.DD_Lock();
+
+ if (!doneFlag) {
+ if (*screenP != 252) {
+ if (_vm->_graphicsManager.Winbpp == 1)
+ _vm->_graphicsManager.Copy_Video_Vbe3(screenP);
+ if (_vm->_graphicsManager.Winbpp == 2)
+ _vm->_graphicsManager.Copy_Video_Vbe16(screenP);
+ }
+ } else if (*screenP != 252) {
+ _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy);
+
+ if (_vm->_graphicsManager.Winbpp == 2)
+ _vm->_graphicsManager.m_scroll16A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
+ else
+ _vm->_graphicsManager.m_scroll2A(screenCopy, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
+ }
+
+ _vm->_graphicsManager.DD_Unlock();
+ _vm->_graphicsManager.DD_VBL();
+ _vm->_soundManager.VERIF_SOUND();
+ }
+ } while (!doneFlag);
+
+ if (_vm->_globals.iRegul != 1) {
+ _vm->_eventsManager.lItCounter = 0;
+ goto FINISH;
+ }
+
+ do {
+ if (_vm->_eventsManager.ESC_KEY)
+ goto FINISH;
+
+ if (REDRAW_ANIM()) {
+REDRAW_ANIM:
+ if (_vm->_graphicsManager.NOLOCK == 1)
+ goto FINISH;
+
+ f.close();
+ if (doneFlag != 1)
+ goto MAIN_LOOP;
+
+ screenCopy = GLOBALS.dos_free2(screenCopy);
+ goto MAIN_LOOP;
+ }
+
+ _vm->_eventsManager.CONTROLE_MES();
+ _vm->_soundManager.VERIF_SOUND();
+ } while (_vm->_eventsManager.lItCounter < rate3);
+
+ _vm->_eventsManager.lItCounter = 0;
+ _vm->_soundManager.VERIF_SOUND();
+ break;
+ }
+
+FINISH:
+ if (_vm->_graphicsManager.FADE_LINUX == 2 && !doneFlag) {
+ screenCopy = GLOBALS.dos_malloc2(SCREEN_WIDTH * SCREEN_HEIGHT);
+
+ f.skip(6);
+ f.read(_vm->_graphicsManager.Palette, 800);
+ f.skip(4);
+ nbytes = f.readUint32LE();
+ v19 = f.readUint32LE();
+ v18 = f.readUint16LE();
+ v17 = f.readUint16LE();
+ v16 = f.readUint16LE();
+ v15 = f.readUint16LE();
+ v14 = f.readUint16LE();
+
+ f.read(screenCopy, nbytes);
+ Common::copy(screenP, screenP + SCREEN_WIDTH * SCREEN_HEIGHT, screenCopy);
+
+ idx = 0;
+ doneFlag = false;
+ do {
+ // Get in string
+ Common::fill(&strBuffer[0], &strBuffer[20], 0);
+ if (f.read(strBuffer, 16) != 16)
+ doneFlag = true;
+
+ if (strncmp(strBuffer, "IMAGE=", 7) != 0)
+ doneFlag = true;
+
+ if (!doneFlag) {
+ f.read(screenP, READ_LE_UINT32(strBuffer + 8));
+
+ if (*screenP != 252)
+ _vm->_graphicsManager.Copy_WinScan_Vbe3(screenP, screenCopy);
+ }
+ } while (!doneFlag);
+
+ _vm->_graphicsManager.FADE_OUTW_LINUX(screenCopy);
+ screenCopy = GLOBALS.dos_free2(screenCopy);
+ }
+
+ if (doneFlag == 1) {
+ if (_vm->_graphicsManager.FADE_LINUX == 2)
+ _vm->_graphicsManager.FADE_OUTW_LINUX(screenCopy);
+ GLOBALS.dos_free2(screenCopy);
+ }
+
+ _vm->_graphicsManager.FADE_LINUX = 0;
+ f.close();
+ GLOBALS.dos_free2(screenCopy);
+ _vm->_graphicsManager.NOLOCK = false;
+}
+
+bool AnimationManager::REDRAW_ANIM() {
+ return false;
+}
+
+} // End of namespace Hopkins
diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h
new file mode 100644
index 0000000000..f064adf534
--- /dev/null
+++ b/engines/hopkins/anim.h
@@ -0,0 +1,50 @@
+/* ScummVM - Graphic Adventure Engine
+ *
+ * ScummVM is the legal property of its developers, whose names
+ * are too numerous to list here. Please refer to the COPYRIGHT
+ * file distributed with this source distribution.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef HOPKINS_ANIM_H
+#define HOPKINS_ANIM_H
+
+#include "common/scummsys.h"
+#include "common/endian.h"
+#include "common/str.h"
+#include "graphics/surface.h"
+
+namespace Hopkins {
+
+class HopkinsEngine;
+
+class AnimationManager {
+public:
+ HopkinsEngine *_vm;
+ bool CLS_ANM;
+ bool NO_SEQ;
+public:
+ AnimationManager();
+ void setParent(HopkinsEngine *vm) { _vm = vm; }
+
+ void PLAY_ANM(const Common::String &filename, uint32 rate, uint32 rate2, uint32 rate3);
+ bool REDRAW_ANIM();
+};
+
+} // End of namespace Hopkins
+
+#endif /* HOPKINS_ANIM_H */
diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp
index f498a4e383..c0c3c6e3e8 100644
--- a/engines/hopkins/events.cpp
+++ b/engines/hopkins/events.cpp
@@ -21,15 +21,31 @@
*/
#include "common/system.h"
+#include "common/events.h"
#include "hopkins/events.h"
namespace Hopkins {
-void Mouse::INSTALL_SOURIS() {
+EventsManager::EventsManager() {
+ souris_flag = false;
+ mouse_linux = false;
+ souris_sizex = souris_sizey = 0;
+ ofset_souris_x = ofset_souris_y = 0;
+ CASSE = false;
+ souris_n = 0;
+ souris_bb = 0;
+ souris_b = 0;
+ pointeur_souris = NULL;
+ lItCounter = 0;
+ ESC_KEY = false;
+ _priorFrameTime = 0;
+}
+
+void EventsManager::INSTALL_SOURIS() {
// No implementation in original
}
-void Mouse::souris_on() {
+void EventsManager::souris_on() {
souris_flag = true;
if (mouse_linux) {
@@ -49,18 +65,53 @@ void Mouse::souris_on() {
souris_xy(150, 100);
}
-void Mouse::souris_xy(int xp, int yp) {
+void EventsManager::souris_xy(int xp, int yp) {
g_system->warpMouse(xp, yp);
}
-void Mouse::souris_max() {
+void EventsManager::souris_max() {
// No implementation in original
}
-void Mouse::hideCursor() {
+void EventsManager::hideCursor() {
+}
+
+void EventsManager::showCursor() {
+}
+
+void EventsManager::CONTROLE_MES() {
+ pollEvents();
}
-void Mouse::showCursor() {
+void EventsManager::pollEvents() {
+ uint32 milli = g_system->getMillis();
+ if ((milli - _priorFrameTime) >= GAME_FRAME_TIME) {
+ _priorFrameTime = milli;
+ ++lItCounter;
+ }
+
+ Common::Event event;
+ while (g_system->getEventManager()->pollEvent(event)) {
+ // Handle keypress
+ switch (event.type) {
+ case Common::EVENT_QUIT:
+ case Common::EVENT_RTL:
+ return;
+
+ case Common::EVENT_KEYDOWN:
+ ESC_KEY = event.kbd.keycode == Common::KEYCODE_ESCAPE;
+ return;
+
+ case Common::EVENT_LBUTTONDOWN:
+ case Common::EVENT_LBUTTONUP:
+ case Common::EVENT_RBUTTONDOWN:
+ case Common::EVENT_RBUTTONUP:
+ return;
+
+ default:
+ break;
+ }
+ }
}
} // End of namespace Hopkins
diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h
index 3293d10b7a..8dc00a04c3 100644
--- a/engines/hopkins/events.h
+++ b/engines/hopkins/events.h
@@ -28,7 +28,12 @@
namespace Hopkins {
-class Mouse {
+#define GAME_FRAME_RATE 50
+#define GAME_FRAME_TIME (1000 / GAME_FRAME_RATE)
+
+class EventsManager {
+private:
+ void pollEvents();
public:
bool souris_flag;
bool mouse_linux;
@@ -41,14 +46,20 @@ public:
int souris_bb;
int souris_b;
void *pointeur_souris;
+ uint32 lItCounter;
+ uint32 _priorFrameTime;
+ bool ESC_KEY;
public:
+ EventsManager();
+
void INSTALL_SOURIS();
void souris_on();
void souris_xy(int xp, int yp);
void souris_max();
-
void hideCursor();
void showCursor();
+
+ void CONTROLE_MES();
};
} // End of namespace Hopkins
diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp
index 837b287ee4..3fd9b54e17 100644
--- a/engines/hopkins/globals.cpp
+++ b/engines/hopkins/globals.cpp
@@ -60,7 +60,7 @@ Globals::Globals() {
CAT_POSI = 0;
CAT_TAILLE = 0;
Nouv_objet = 0;
-
+ iRegul = 0;
// Initialise pointers
ICONE = NULL;
diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h
index 201f22b4f7..84c8ad62b0 100644
--- a/engines/hopkins/globals.h
+++ b/engines/hopkins/globals.h
@@ -201,6 +201,7 @@ public:
int HELICO;
uint32 CAT_POSI;
uint32 CAT_TAILLE;
+ int iRegul;
Globals();
~Globals();
diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp
index d326598e56..9e878cc822 100644
--- a/engines/hopkins/graphics.cpp
+++ b/engines/hopkins/graphics.cpp
@@ -55,6 +55,8 @@ GraphicsManager::GraphicsManager() {
Agr_x = Agr_y = 0;
Agr_Flag_x = Agr_Flag_y = 0;
FADESPD = 15;
+ FADE_LINUX = 0;
+ NOLOCK = false;
Common::fill(&SD_PIXELS[0], &SD_PIXELS[PALETTE_SIZE * 2], 0);
Common::fill(&TABLE_COUL[0], &TABLE_COUL[PALETTE_SIZE], 0);
@@ -63,8 +65,8 @@ GraphicsManager::GraphicsManager() {
}
GraphicsManager::~GraphicsManager() {
- VESA_SCREEN.free();
- VESA_BUFFER.free();
+ GLOBALS.dos_free2(VESA_SCREEN);
+ GLOBALS.dos_free2(VESA_BUFFER);
}
void GraphicsManager::SET_MODE(int width, int height) {
@@ -104,8 +106,8 @@ void GraphicsManager::SET_MODE(int width, int height) {
}
// Init surfaces
- VESA_SCREEN.create(SCREEN_WIDTH, SCREEN_HEIGHT, pixelFormat16);
- VESA_BUFFER.create(SCREEN_WIDTH, SCREEN_HEIGHT, pixelFormat16);
+ VESA_SCREEN = GLOBALS.dos_malloc2(SCREEN_WIDTH * 2 * SCREEN_HEIGHT);
+ VESA_BUFFER = GLOBALS.dos_malloc2(SCREEN_WIDTH * 2 * SCREEN_HEIGHT);
VideoPtr = NULL;
XSCREEN = width;
@@ -126,8 +128,10 @@ void GraphicsManager::SET_MODE(int width, int height) {
}
void GraphicsManager::DD_Lock() {
- if (_lockCtr++ == 0)
- VideoPtr = g_system->lockScreen();
+ if (!NOLOCK) {
+ if (_lockCtr++ == 0)
+ VideoPtr = g_system->lockScreen();
+ }
}
void GraphicsManager::DD_Unlock() {
@@ -168,7 +172,7 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) {
}
SCROLL_ECRAN(0);
- A_PCX640_480((byte *)VESA_SCREEN.pixels, file, Palette, flag);
+ A_PCX640_480((byte *)VESA_SCREEN, file, Palette, flag);
SCROLL = 0;
OLD_SCROLL = 0;
@@ -182,14 +186,14 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) {
Cls_Video();
if (Winbpp == 2) {
if (SDL_ECHELLE)
- m_scroll16A((byte *)VESA_SCREEN.pixels, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
+ m_scroll16A((byte *)VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
else
- m_scroll16((byte *)VESA_SCREEN.pixels, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
+ m_scroll16((byte *)VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
} else if (Winbpp == 1) {
if (!SDL_ECHELLE)
- m_scroll2((byte *)VESA_SCREEN.pixels, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
+ m_scroll2((byte *)VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
else
- m_scroll2A((byte *)VESA_SCREEN.pixels, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
+ m_scroll2A((byte *)VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
}
DD_Unlock();
@@ -204,22 +208,22 @@ void GraphicsManager::CHARGE_ECRAN(const Common::String &file) {
DD_Lock();
if (Winbpp == 2) {
if (SDL_ECHELLE)
- m_scroll16A((byte *)VESA_SCREEN.pixels, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
+ m_scroll16A((byte *)VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
else
- m_scroll16((byte *)VESA_SCREEN.pixels, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
+ m_scroll16((byte *)VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
}
if (Winbpp == 1) {
if (!SDL_ECHELLE)
- m_scroll2((byte *)VESA_SCREEN.pixels, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
+ m_scroll2((byte *)VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
else
- m_scroll2A((byte *)VESA_SCREEN.pixels, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
+ m_scroll2A((byte *)VESA_SCREEN, 0, 0, SCREEN_WIDTH, SCREEN_HEIGHT, 0, 0);
}
DD_Unlock();
}
}
- memcpy((byte *)VESA_BUFFER.pixels, (byte *)VESA_SCREEN.pixels, SCREEN_WIDTH * 2 * SCREEN_HEIGHT);
+ memcpy((byte *)VESA_BUFFER, (byte *)VESA_SCREEN, SCREEN_WIDTH * 2 * SCREEN_HEIGHT);
}
void GraphicsManager::INIT_TABLE(int a1, int a2, byte *palette) {
@@ -812,22 +816,22 @@ LABEL_28:
void GraphicsManager::FADE_INS() {
FADESPD = 1;
- fade_in(Palette, 1, (const byte *)VESA_BUFFER.pixels);
+ fade_in(Palette, 1, (const byte *)VESA_BUFFER);
}
void GraphicsManager::FADE_OUTS() {
FADESPD = 1;
- fade_out(Palette, 1, (const byte *)VESA_BUFFER.pixels);
+ fade_out(Palette, 1, (const byte *)VESA_BUFFER);
}
void GraphicsManager::FADE_INW() {
FADESPD = 15;
- fade_in(Palette, 20, (const byte *)VESA_BUFFER.pixels);
+ fade_in(Palette, 20, (const byte *)VESA_BUFFER);
}
void GraphicsManager::FADE_OUTW() {
FADESPD = 15;
- fade_out(Palette, 20, (const byte *)VESA_BUFFER.pixels);
+ fade_out(Palette, 20, (const byte *)VESA_BUFFER);
}
void GraphicsManager::setpal_vga256(const byte *palette) {
@@ -869,6 +873,21 @@ void GraphicsManager::DD_VBL() {
g_system->updateScreen();
}
+void GraphicsManager::FADE_OUTW_LINUX(const byte *surface) {
+ warning("TODO: FADE_OUTW_LINUX");
+}
+
+void GraphicsManager::Copy_WinScan_Vbe3(const byte *sourceSurface, byte *destSurface) {
+ warning("TODO: Copy_WinScan_Vbe3");
+}
+
+void GraphicsManager::Copy_Video_Vbe3(const byte *surface) {
+ warning("TODO: Copy_Video_Vbe3");
+}
+
+void GraphicsManager::Copy_Video_Vbe16(const byte *surface) {
+ warning("TODO: Copy_Video_Vbe3");
+}
/*------------------------------------------------------------------------*/
diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h
index 804498c122..6451fdae5c 100644
--- a/engines/hopkins/graphics.h
+++ b/engines/hopkins/graphics.h
@@ -55,11 +55,11 @@ public:
int nbrligne;
byte TABLE_COUL[PALETTE_SIZE];
byte cmap[PALETTE_BLOCK_SIZE];
- byte Palette[PALETTE_BLOCK_SIZE];
+ byte Palette[800];
bool Linear;
Graphics::Surface *VideoPtr;
- Graphics::Surface VESA_SCREEN;
- Graphics::Surface VESA_BUFFER;
+ byte *VESA_SCREEN;
+ byte *VESA_BUFFER;
int start_x;
int ofscroll;
int SCROLL;
@@ -74,6 +74,8 @@ public:
int Agr_Flag_x, Agr_Flag_y;
int FADESPD;
byte PALPCX[800];
+ int FADE_LINUX;
+ bool NOLOCK;
public:
GraphicsManager();
~GraphicsManager();
@@ -105,6 +107,10 @@ public:
void CHANGE_PALETTE(const byte *palette);
uint16 MapRGB(byte r, byte g, byte b);
void DD_VBL();
+ void FADE_OUTW_LINUX(const byte *surface);
+ void Copy_WinScan_Vbe3(const byte *sourceSurface, byte *destSurface);
+ void Copy_Video_Vbe3(const byte *surface);
+ void Copy_Video_Vbe16(const byte *surface);
};
class ObjectManager {
diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp
index e5ba60f402..dae6cceb03 100644
--- a/engines/hopkins/hopkins.cpp
+++ b/engines/hopkins/hopkins.cpp
@@ -35,8 +35,10 @@ namespace Hopkins {
HopkinsEngine *g_vm;
HopkinsEngine::HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDesc) : Engine(syst),
- _gameDescription(gameDesc), _randomSource("Hopkins") {
+ _gameDescription(gameDesc), _randomSource("Hopkins"), _animationManager() {
g_vm = this;
+ _animationManager.setParent(this);
+ _soundManager.setParent(this);
}
HopkinsEngine::~HopkinsEngine() {
@@ -54,14 +56,14 @@ Common::Error HopkinsEngine::run() {
INIT_SYSTEM();
Init_Interrupt();
- SoundManager::WSOUND_INIT();
+ _soundManager.WSOUND_INIT();
GLOBALS.CHARGE_OBJET();
ObjectManager::CHANGE_OBJET(14);
ObjectManager::AJOUTE_OBJET(14);
GLOBALS.HELICO = 0;
- _mouse.hideCursor();
+ _eventsManager.hideCursor();
_graphicsManager.DD_Lock();
_graphicsManager.Cls_Video();
@@ -71,14 +73,13 @@ Common::Error HopkinsEngine::run() {
_graphicsManager.FADE_INW();
delay(1500);
-/*
- SDL_Delay(1500);
- FADE_OUTW();
- if ( !internet )
- {
- FADE_LINUX = 2;
- PLAY_ANM("MP.ANM", 10, 16, 200);
- }
+ _graphicsManager.FADE_OUTW();
+
+ if (!GLOBALS.internet) {
+ _graphicsManager.FADE_LINUX = 2;
+ _animationManager.PLAY_ANM("MP.ANM", 10, 16, 200);
+ }
+ /*
LOAD_IMAGE("H2");
FADE_INW();
SDL_Delay(500);
@@ -475,7 +476,7 @@ LABEL_128:
// Copy vesa surface to screen
_graphicsManager.DD_Lock();
- const byte *srcP = (const byte *)_graphicsManager.VESA_SCREEN.pixels;
+ const byte *srcP = (const byte *)_graphicsManager.VESA_SCREEN;
uint16 *destP = (uint16 *)_graphicsManager.VideoPtr->pixels;
for (int i = 0; i < (SCREEN_WIDTH * SCREEN_HEIGHT); ++i, ++srcP, ++destP) {
byte r = _graphicsManager.Palette[*srcP * 3];
@@ -526,13 +527,13 @@ void HopkinsEngine::INIT_SYSTEM() {
// Set graphics mode
_graphicsManager.SET_MODE(640, 480);
- _mouse.mouse_linux = true;
+ _eventsManager.mouse_linux = true;
switch (GLOBALS.FR) {
case 0:
- if (!_mouse.mouse_linux)
+ if (!_eventsManager.mouse_linux)
FileManager::CONSTRUIT_SYSTEM("SOUAN.SPR");
- if (!GLOBALS.FR && _mouse.mouse_linux)
+ if (!GLOBALS.FR && _eventsManager.mouse_linux)
FileManager::CONSTRUIT_SYSTEM("LSOUAN.SPR");
break;
case 1:
@@ -543,14 +544,14 @@ void HopkinsEngine::INIT_SYSTEM() {
break;
}
- if (_mouse.mouse_linux) {
- _mouse.souris_sizex = 52;
- _mouse.souris_sizey = 32;
+ if (_eventsManager.mouse_linux) {
+ _eventsManager.souris_sizex = 52;
+ _eventsManager.souris_sizey = 32;
} else {
- _mouse.souris_sizex = 34;
- _mouse.souris_sizey = 20;
+ _eventsManager.souris_sizex = 34;
+ _eventsManager.souris_sizey = 20;
}
- _mouse.pointeur_souris = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER);
+ _eventsManager.pointeur_souris = FileManager::CHARGE_FICHIER(GLOBALS.NFICHIER);
GLOBALS.clearAll();
@@ -583,15 +584,15 @@ void HopkinsEngine::INIT_SYSTEM() {
GLOBALS.max_x = 1280;
GLOBALS.max_y = 460;
- _mouse.INSTALL_SOURIS();
- _mouse.souris_on();
- _mouse.souris_flag = false;
- _mouse.souris_max();
+ _eventsManager.INSTALL_SOURIS();
+ _eventsManager.souris_on();
+ _eventsManager.souris_flag = false;
+ _eventsManager.souris_max();
GLOBALS.HOPKINS_DATA();
- _mouse.ofset_souris_x = 0;
- _mouse.ofset_souris_y = 0;
+ _eventsManager.ofset_souris_x = 0;
+ _eventsManager.ofset_souris_y = 0;
GLOBALS.lItCounter = 0;
GLOBALS.lOldItCounter = 0;
}
diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h
index c9c956ed53..6a9398fd49 100644
--- a/engines/hopkins/hopkins.h
+++ b/engines/hopkins/hopkins.h
@@ -31,9 +31,11 @@
#include "common/util.h"
#include "engines/engine.h"
#include "graphics/surface.h"
+#include "hopkins/anim.h"
#include "hopkins/events.h"
#include "hopkins/globals.h"
#include "hopkins/graphics.h"
+#include "hopkins/sound.h"
/**
* This is the namespace of the Hopkins engine.
@@ -66,8 +68,6 @@ class HopkinsEngine : public Engine {
private:
const HopkinsGameDescription *_gameDescription;
Common::RandomSource _randomSource;
- Mouse _mouse;
- GraphicsManager _graphicsManager;
/**
* Processes the loaded list of ini file parameters
@@ -83,7 +83,10 @@ protected:
public:
Globals _globals;
-
+ EventsManager _eventsManager;
+ GraphicsManager _graphicsManager;
+ AnimationManager _animationManager;
+ SoundManager _soundManager;
public:
HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDesc);
virtual ~HopkinsEngine();
diff --git a/engines/hopkins/module.mk b/engines/hopkins/module.mk
index 2bff26dbb2..b0b00f9aba 100644
--- a/engines/hopkins/module.mk
+++ b/engines/hopkins/module.mk
@@ -1,6 +1,7 @@
MODULE := engines/hopkins
MODULE_OBJS := \
+ anim.o \
detection.o \
events.o \
files.o \
diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp
index f11bc25cae..15e8e3b61b 100644
--- a/engines/hopkins/sound.cpp
+++ b/engines/hopkins/sound.cpp
@@ -25,8 +25,24 @@
namespace Hopkins {
+void SoundManager::setParent(HopkinsEngine *vm) {
+ _vm = vm;
+}
+
void SoundManager::WSOUND_INIT() {
// TODO: WSOUND_INIT
}
+void SoundManager::VERIF_SOUND() {
+
+}
+
+void SoundManager::LOAD_ANM_SOUND() {
+
+}
+
+void SoundManager::PLAY_ANM_SOUND(int soundNumber) {
+
+}
+
} // End of namespace Hopkins
diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h
index 15469ff8b5..d465140f54 100644
--- a/engines/hopkins/sound.h
+++ b/engines/hopkins/sound.h
@@ -28,9 +28,18 @@
namespace Hopkins {
+class HopkinsEngine;
+
class SoundManager {
public:
- static void WSOUND_INIT();
+ HopkinsEngine *_vm;
+public:
+ void setParent(HopkinsEngine *vm);
+
+ void WSOUND_INIT();
+ void VERIF_SOUND();
+ void LOAD_ANM_SOUND();
+ void PLAY_ANM_SOUND(int soundNumber);
};
} // End of namespace Hopkins