diff options
-rw-r--r-- | engines/hopkins/anim.cpp | 12 | ||||
-rw-r--r-- | engines/hopkins/anim.h | 3 | ||||
-rw-r--r-- | engines/hopkins/events.cpp | 20 | ||||
-rw-r--r-- | engines/hopkins/events.h | 11 | ||||
-rw-r--r-- | engines/hopkins/globals.cpp | 1 | ||||
-rw-r--r-- | engines/hopkins/globals.h | 1 | ||||
-rw-r--r-- | engines/hopkins/graphics.cpp | 20 | ||||
-rw-r--r-- | engines/hopkins/graphics.h | 7 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 296 | ||||
-rw-r--r-- | engines/hopkins/hopkins.h | 6 | ||||
-rw-r--r-- | engines/hopkins/sound.cpp | 16 | ||||
-rw-r--r-- | engines/hopkins/sound.h | 4 |
12 files changed, 369 insertions, 28 deletions
diff --git a/engines/hopkins/anim.cpp b/engines/hopkins/anim.cpp index cb3c5af2c5..6eadbd413c 100644 --- a/engines/hopkins/anim.cpp +++ b/engines/hopkins/anim.cpp @@ -279,4 +279,16 @@ bool AnimationManager::REDRAW_ANIM() { return false; } +void AnimationManager::BOBANIM_ON(int a1) { + warning("TODO: BOBANIM_ON"); +} + +void AnimationManager::BOBANIM_OFF(int a1) { + warning("TODO: BOBANIM_OFF"); +} + +void AnimationManager::CHARGE_ANIM(const Common::String &filename) { + warning("TODO: CHARGE_ANIM"); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/anim.h b/engines/hopkins/anim.h index f064adf534..b18fc9be80 100644 --- a/engines/hopkins/anim.h +++ b/engines/hopkins/anim.h @@ -43,6 +43,9 @@ public: void PLAY_ANM(const Common::String &filename, uint32 rate, uint32 rate2, uint32 rate3); bool REDRAW_ANIM(); + void BOBANIM_ON(int a1); + void BOBANIM_OFF(int a1); + void CHARGE_ANIM(const Common::String &filename); }; } // End of namespace Hopkins diff --git a/engines/hopkins/events.cpp b/engines/hopkins/events.cpp index 49e472ad17..279b8ac7b8 100644 --- a/engines/hopkins/events.cpp +++ b/engines/hopkins/events.cpp @@ -22,6 +22,7 @@ #include "common/system.h" #include "common/events.h" +#include "common/textconsole.h" #include "hopkins/events.h" namespace Hopkins { @@ -31,6 +32,7 @@ EventsManager::EventsManager() { mouse_linux = false; souris_sizex = souris_sizey = 0; ofset_souris_x = ofset_souris_y = 0; + start_x = start_y = 0; CASSE = false; souris_n = 0; souris_bb = 0; @@ -73,6 +75,20 @@ void EventsManager::souris_max() { // No implementation in original } +int EventsManager::XMOUSE() { + souris_x = start_x + g_system->getEventManager()->getMousePos().x; + souris_y = g_system->getEventManager()->getMousePos().y; + + return souris_x + ofset_souris_x; +} + +int EventsManager::YMOUSE() { + souris_x = start_x + g_system->getEventManager()->getMousePos().x; + souris_y = g_system->getEventManager()->getMousePos().y; + + return souris_x + ofset_souris_x; +} + void EventsManager::hideCursor() { } @@ -128,4 +144,8 @@ void EventsManager::pollEvents() { } } +void EventsManager::VBL() { + warning("TODO: VBL"); +} + } // End of namespace Hopkins diff --git a/engines/hopkins/events.h b/engines/hopkins/events.h index 19629bfc5f..ca6d8e5fd2 100644 --- a/engines/hopkins/events.h +++ b/engines/hopkins/events.h @@ -38,10 +38,10 @@ private: public: bool souris_flag; bool mouse_linux; - int souris_sizex; - int souris_sizey; - int ofset_souris_x; - int ofset_souris_y; + int souris_sizex, souris_sizey; + int ofset_souris_x, ofset_souris_y; + int start_x, start_y; + int souris_x, souris_y; bool CASSE; int souris_n; int souris_bb; @@ -57,8 +57,11 @@ public: void souris_on(); void souris_xy(int xp, int yp); void souris_max(); + int XMOUSE(); + int YMOUSE(); void hideCursor(); void showCursor(); + void VBL(); void CONTROLE_MES(); void delay(int delay); diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 3fd9b54e17..f7d94ee90f 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -101,6 +101,7 @@ Globals::Globals() { CENSURE = false; GESTE_FLAG = false; redraw = false; + BPP_NOAFF = false; } Globals::~Globals() { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 84c8ad62b0..0495607b5d 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -202,6 +202,7 @@ public: uint32 CAT_POSI; uint32 CAT_TAILLE; int iRegul; + bool BPP_NOAFF; Globals(); ~Globals(); diff --git a/engines/hopkins/graphics.cpp b/engines/hopkins/graphics.cpp index 9e878cc822..26907c235e 100644 --- a/engines/hopkins/graphics.cpp +++ b/engines/hopkins/graphics.cpp @@ -57,6 +57,7 @@ GraphicsManager::GraphicsManager() { FADESPD = 15; FADE_LINUX = 0; NOLOCK = false; + no_scroll = 0; Common::fill(&SD_PIXELS[0], &SD_PIXELS[PALETTE_SIZE * 2], 0); Common::fill(&TABLE_COUL[0], &TABLE_COUL[PALETTE_SIZE], 0); @@ -838,6 +839,17 @@ void GraphicsManager::setpal_vga256(const byte *palette) { CHANGE_PALETTE(palette); } +void GraphicsManager::setpal_vga256_linux(const byte *palette, const byte *surface) { + warning("TODO: setpal_vga256_linux"); +} + +void GraphicsManager::SETCOLOR3(int palIndex, int r, int g, int b) { + int offset = palIndex * 3; + Palette[offset] = 255 * r / 100; + Palette[offset + 1] = 255 * g / 100; + Palette[offset + 2] = 255 * b / 100; +} + void GraphicsManager::CHANGE_PALETTE(const byte *palette) { // Copy the palette into the PALPCX block // TODO: Likely either one or both of the destination arrays can be removed, @@ -889,6 +901,14 @@ void GraphicsManager::Copy_Video_Vbe16(const byte *surface) { warning("TODO: Copy_Video_Vbe3"); } +void GraphicsManager::FIN_VISU() { + warning("TODO: FIN_VISU"); +} + +void GraphicsManager::VISU_ALL() { + warning("TODO: VISU_ALL"); +} + /*------------------------------------------------------------------------*/ byte *ObjectManager::CHANGE_OBJET(int objIndex) { diff --git a/engines/hopkins/graphics.h b/engines/hopkins/graphics.h index 6451fdae5c..756ae49cbe 100644 --- a/engines/hopkins/graphics.h +++ b/engines/hopkins/graphics.h @@ -76,6 +76,7 @@ public: byte PALPCX[800]; int FADE_LINUX; bool NOLOCK; + int no_scroll; public: GraphicsManager(); ~GraphicsManager(); @@ -83,6 +84,8 @@ public: void SET_MODE(int width, int height); void DD_Lock(); void DD_Unlock(); + void DD_LOCK() { DD_Lock(); } + void DD_UNLOCK() { DD_Unlock(); } void Cls_Video(); void LOAD_IMAGE(const Common::String &file); void INIT_TABLE(int a1, int a2, byte *a3); @@ -104,6 +107,8 @@ public: void FADE_INW(); void FADE_OUTW(); void setpal_vga256(const byte *palette); + void setpal_vga256_linux(const byte *palette, const byte *surface); + void SETCOLOR3(int palIndex, int r, int g, int b); void CHANGE_PALETTE(const byte *palette); uint16 MapRGB(byte r, byte g, byte b); void DD_VBL(); @@ -111,6 +116,8 @@ public: void Copy_WinScan_Vbe3(const byte *sourceSurface, byte *destSurface); void Copy_Video_Vbe3(const byte *surface); void Copy_Video_Vbe16(const byte *surface); + void FIN_VISU(); + void VISU_ALL(); }; class ObjectManager { diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index a0d192e091..0cfb263972 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -54,7 +54,6 @@ Common::Error HopkinsEngine::run() { GLOBALS.setConfig(); FileManager::F_Censure(); INIT_SYSTEM(); - Init_Interrupt(); _soundManager.WSOUND_INIT(); @@ -84,10 +83,11 @@ Common::Error HopkinsEngine::run() { _graphicsManager.FADE_INW(); _eventsManager.delay(500); _graphicsManager.FADE_OUTW(); -/* - if ( !ESC_KEY ) - INTRORUN(a1); - iRegul = 0; + + if (!_eventsManager.ESC_KEY) + INTRORUN(); + /* + _globals.iRegul = 0; CONSTRUIT_SYSTEM("PERSO.SPR"); PERSO = CHARGE_FICHIER(GLOBALS.NFICHIER); PERSO_TYPE = 0; @@ -150,7 +150,7 @@ LABEL_13: break; if ( !*((_BYTE *)SAUVEGARDE + 170) ) { - WSOUND(3); + _soundManager.WSOUND(3); if ( FR == 1 ) LOAD_IMAGE("fondfr"); if ( !FR ) @@ -160,8 +160,8 @@ LABEL_13: FADE_INW(); SDL_Delay(500); FADE_OUTW(); - iRegul = 1; - SPECIAL_SOUND = 2; + _globals.iRegul = 1; + _soundManager.SPECIAL_SOUND = 2; DD_Lock(); Cls_Video(); DD_Unlock(); @@ -171,7 +171,7 @@ LABEL_13: PLAY_ANM("BANQUE.ANM", 200, 28, 200); if ( CENSURE == 1 ) PLAY_ANM("BANKUK.ANM", 200, 28, 200); - SPECIAL_SOUND = 0; + _soundManager.SPECIAL_SOUND = 0; DEL_SAMPLE(1); DEL_SAMPLE(2); DEL_SAMPLE(3); @@ -425,41 +425,41 @@ LABEL_128: { if ( SORTIE == 151 ) { - WSOUND(16); - iRegul = 1; + _soundManager.WSOUND(16); + _globals.iRegul = 1; DD_Lock(); Cls_Video(); DD_Unlock(); Cls_Pal(); FADE_LINUX = 2; PLAY_ANM("JOUR3A.anm", 12, 12, 2000); - iRegul = 0; + _globals.iRegul = 0; SORTIE = 300; } if ( SORTIE == 150 ) { - WSOUND(16); - iRegul = 1; + _soundManager.WSOUND(16); + _globals.iRegul = 1; DD_Lock(); Cls_Video(); DD_Unlock(); Cls_Pal(); FADE_LINUX = 2; PLAY_ANM("JOUR1A.anm", 12, 12, 2000); - iRegul = 0; + _globals.iRegul = 0; SORTIE = 300; } if ( SORTIE == 152 ) { - WSOUND(16); - iRegul = 1; + _soundManager.WSOUND(16); + _globals.iRegul = 1; DD_Lock(); Cls_Video(); DD_Unlock(); Cls_Pal(); FADE_LINUX = 2; PLAY_ANM("JOUR4A.anm", 12, 12, 2000); - iRegul = 0; + _globals.iRegul = 0; SORTIE = 300; } goto LABEL_12; @@ -598,8 +598,264 @@ void HopkinsEngine::INIT_SYSTEM() { GLOBALS.lOldItCounter = 0; } -void HopkinsEngine::Init_Interrupt() { - // TODO: Determine whether the timer is needed +void HopkinsEngine::INTRORUN() { + signed int v2; + signed int v3; + unsigned __int16 v4; + signed int v5; + int i; + int v7; + signed int v8; + signed int v9; + signed int v11; + int v12; + signed int v13; + signed int v14; + int j; + int k; + int l; + int m; + __int16 v21; + char v22; + char v23; + byte paletteData[800]; + byte paletteData2[800]; + + memset(&paletteData, 0, 800); + _eventsManager.VBL(); + _eventsManager.souris_flag = 0; + _globals.iRegul = 1; + _eventsManager.VBL(); + _soundManager.WSOUND(16); + _animationManager.CLS_ANM = 1; + _animationManager.PLAY_ANM("J1.anm", 12, 12, 50); + if (!_eventsManager.ESC_KEY) { + _soundManager.VOICE_MIX(1, 3); + _animationManager.PLAY_ANM("J2.anm", 12, 12, 50); + + if (!_eventsManager.ESC_KEY) { + _soundManager.VOICE_MIX(2, 3); + _animationManager.PLAY_ANM("J3.anm", 12, 12, 50); + + if (!_eventsManager.ESC_KEY) { + _soundManager.VOICE_MIX(3, 3); + _graphicsManager.DD_LOCK(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_UNLOCK(); + _graphicsManager.Cls_Pal(); + _graphicsManager.DD_VBL(); + _soundManager.WSOUND(11); + _graphicsManager.LOAD_IMAGE("intro1"); + _graphicsManager.SCROLL_ECRAN(0); + _graphicsManager.ofscroll = 0; + _graphicsManager.SETCOLOR3(252, 100, 100, 100); + _graphicsManager.SETCOLOR3(253, 100, 100, 100); + _graphicsManager.SETCOLOR3(251, 100, 100, 100); + _graphicsManager.SETCOLOR3(254, 0, 0, 0); + _globals.BPP_NOAFF = 1; + v2 = 0; + do { + _eventsManager.VBL(); + ++v2; + } while (v2 <= 4); + + _globals.BPP_NOAFF = 0; + _globals.iRegul = 1; + _graphicsManager.FADE_INW(); + if (_graphicsManager.DOUBLE_ECRAN == 1) { + _graphicsManager.no_scroll = 2; + v3 = 0; + _graphicsManager.SCROLL = 0; + + do { + _graphicsManager.SCROLL += 2; + if (_graphicsManager.SCROLL > (SCREEN_WIDTH - 2)) { + _graphicsManager.SCROLL = SCREEN_WIDTH; + v3 = 1; + } + + if (_eventsManager.XMOUSE() < _graphicsManager.SCROLL + 10) { + v4 = _eventsManager.YMOUSE(); + _eventsManager.souris_xy(_eventsManager.souris_x + 4, v4); + } + _eventsManager.VBL(); + } while (v3 != 1 && _graphicsManager.SCROLL != SCREEN_WIDTH); + + _eventsManager.VBL(); + _graphicsManager.no_scroll = 0; + } + + _soundManager.VOICE_MIX(4, 3); + _graphicsManager.FADE_OUTW(); + _graphicsManager.no_scroll = 0; + _graphicsManager.LOAD_IMAGE("intro2"); + _graphicsManager.SCROLL_ECRAN(0); + _animationManager.CHARGE_ANIM("INTRO2"); + _graphicsManager.VISU_ALL(); + _soundManager.WSOUND(23); + _animationManager.BOBANIM_OFF(3); + _animationManager.BOBANIM_OFF(5); + _graphicsManager.ofscroll = 0; + _graphicsManager.SETCOLOR3(252, 100, 100, 100); + _graphicsManager.SETCOLOR3(253, 100, 100, 100); + _graphicsManager.SETCOLOR3(251, 100, 100, 100); + _graphicsManager.SETCOLOR3(254, 0, 0, 0); + _globals.BPP_NOAFF = 1; + v5 = 0; + + do { + _eventsManager.VBL(); + ++v5; + } while (v5 <= 4); + + _globals.BPP_NOAFF = 0; + _globals.iRegul = 1; + _graphicsManager.FADE_INW(); + for (i = 0; i < 200 / _globals.vitesse; ++i) + _eventsManager.VBL(); + + _animationManager.BOBANIM_ON(3); + _soundManager.VOICE_MIX(5, 3); + _animationManager.BOBANIM_OFF(3); + _eventsManager.VBL(); + memcpy(&paletteData2, _graphicsManager.Palette, 796); + v21 = *(uint16 *)&_graphicsManager.Palette[796]; + v22 = _graphicsManager.Palette[798]; + v7 = (int)&v23; + _graphicsManager.setpal_vga256_linux(paletteData, _graphicsManager.VESA_BUFFER); + _graphicsManager.FIN_VISU(); + _soundManager.SPECIAL_SOUND = 5; + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("ELEC.ANM", 10, 26, 200); + _soundManager.SPECIAL_SOUND = 0; + + if (!_eventsManager.ESC_KEY) { + _graphicsManager.LOAD_IMAGE("intro2"); + _graphicsManager.SCROLL_ECRAN(0); + _animationManager.CHARGE_ANIM("INTRO2"); + _graphicsManager.VISU_ALL(); + _soundManager.WSOUND(23); + _animationManager.BOBANIM_OFF(3); + _animationManager.BOBANIM_OFF(5); + _animationManager.BOBANIM_OFF(1); + _graphicsManager.ofscroll = 0; + _graphicsManager.SETCOLOR3(252, 100, 100, 100); + _graphicsManager.SETCOLOR3(253, 100, 100, 100); + _graphicsManager.SETCOLOR3(251, 100, 100, 100); + _graphicsManager.SETCOLOR3(254, 0, 0, 0); + _globals.BPP_NOAFF = 1; + v8 = 0; + + do { + _eventsManager.VBL(); + ++v8; + } while (v8 <= 3); + + _globals.BPP_NOAFF = 0; + _globals.iRegul = 1; + _graphicsManager.setpal_vga256_linux(paletteData2, _graphicsManager.VESA_BUFFER); + v9 = 0; + + while (!_eventsManager.ESC_KEY) { + if (v9 == 12) { + _animationManager.BOBANIM_ON(3); + _eventsManager.VBL(); + _soundManager.VOICE_MIX(6, 3); + _eventsManager.VBL(); + _animationManager.BOBANIM_OFF(3); + } + + Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager.Palette[0]); + + v11 = 1; + v12 = 4 * v9; + do { + if (_graphicsManager.Palette[v11] > v12) + _graphicsManager.Palette[v11] -= v12; + ++v11; + } while ( v11 <= PALETTE_BLOCK_SIZE); + + _graphicsManager.setpal_vga256_linux(_graphicsManager.Palette, _graphicsManager.VESA_BUFFER); + v13 = 1; + + if (2 * v9 > 1) { + v7 = 2 * v9; + + do { + _eventsManager.VBL(); + ++v13; + } while (v13 < v7); + } + + _graphicsManager.setpal_vga256_linux(paletteData2, _graphicsManager.VESA_BUFFER); + v14 = 1; + if (20 - v9 > 1) { + v7 = 20 - v9; + + do { + _eventsManager.VBL(); + ++v14; + } while (v14 < v7); + } + + v9 += 2; + if (v9 > 15) { + _graphicsManager.setpal_vga256_linux(paletteData, _graphicsManager.VESA_BUFFER); + for (j = 1; j < 100 / _globals.vitesse; ++j) + _eventsManager.VBL(); + + _animationManager.BOBANIM_ON(3); + _soundManager.VOICE_MIX(7, 3); + _animationManager.BOBANIM_OFF(3); + + for (k = 1; k < 60 / _globals.vitesse; ++k) + _eventsManager.VBL(); + _animationManager.BOBANIM_ON(5); + for (l = 0; l < 20 / _globals.vitesse; ++l) + _eventsManager.VBL(); + + Common::copy(&paletteData2[0], &paletteData2[PALETTE_BLOCK_SIZE], &_graphicsManager.Palette[0]); + _graphicsManager.setpal_vga256_linux(_graphicsManager.Palette, _graphicsManager.VESA_BUFFER); + + for (m = 0; m < 50 / _globals.vitesse; ++m) { + if (m == 30 / _globals.vitesse) { + _animationManager.BOBANIM_ON(3); + _soundManager.VOICE_MIX(8, 3); + _animationManager.BOBANIM_OFF(3); + } + + _eventsManager.VBL(); + } + + _graphicsManager.FADE_OUTW(); + _graphicsManager.FIN_VISU(); + _animationManager.CLS_ANM = 1; + _soundManager.WSOUND(3); + _soundManager.SPECIAL_SOUND = 1; + _animationManager.PLAY_ANM("INTRO1.anm", 10, 24, 18); + _soundManager.SPECIAL_SOUND = 0; + + if (!_eventsManager.ESC_KEY) { + _animationManager.PLAY_ANM("INTRO2.anm", 10, 24, 18); + + if (!_eventsManager.ESC_KEY) { + _animationManager.PLAY_ANM("INTRO3.anm", 10, 24, 200); + if (!_eventsManager.ESC_KEY) { + _animationManager.CLS_ANM = 0; + _graphicsManager.FADE_LINUX = 2; + _animationManager.PLAY_ANM("J4.anm", 12, 12, 1000); + } + } + } + break; + } + } + } + } + } + } + + _eventsManager.ESC_KEY = false; } } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 568b9db6db..df4c2b793f 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -75,7 +75,11 @@ private: void processIniParams(Common::StringMap &iniParams); void INIT_SYSTEM(); - void Init_Interrupt(); + + /** + * Run the introduction sequence + */ + void INTRORUN(); protected: // Engine APIs virtual Common::Error run(); diff --git a/engines/hopkins/sound.cpp b/engines/hopkins/sound.cpp index 15e8e3b61b..f38deb408b 100644 --- a/engines/hopkins/sound.cpp +++ b/engines/hopkins/sound.cpp @@ -21,28 +21,38 @@ */ #include "common/system.h" +#include "common/textconsole.h" #include "hopkins/sound.h" namespace Hopkins { void SoundManager::setParent(HopkinsEngine *vm) { _vm = vm; + SPECIAL_SOUND = 0; } void SoundManager::WSOUND_INIT() { - // TODO: WSOUND_INIT + warning("TODO: WSOUND_INIT"); } void SoundManager::VERIF_SOUND() { - + warning("TODO: VERIF_SOUND"); } void SoundManager::LOAD_ANM_SOUND() { - + warning("TODO: LOAD_ANIM_SOUND"); } void SoundManager::PLAY_ANM_SOUND(int soundNumber) { + warning("TODO: PLAAY_ANIM_SOUND"); +} + +void SoundManager::WSOUND(int soundNumber) { + warning("TODO: WSOUND"); +} +void SoundManager::VOICE_MIX(int a1, int a2) { + warning("TODO: VOICE_MIX"); } } // End of namespace Hopkins diff --git a/engines/hopkins/sound.h b/engines/hopkins/sound.h index d465140f54..0e8897f8af 100644 --- a/engines/hopkins/sound.h +++ b/engines/hopkins/sound.h @@ -33,6 +33,8 @@ class HopkinsEngine; class SoundManager { public: HopkinsEngine *_vm; + + int SPECIAL_SOUND; public: void setParent(HopkinsEngine *vm); @@ -40,6 +42,8 @@ public: void VERIF_SOUND(); void LOAD_ANM_SOUND(); void PLAY_ANM_SOUND(int soundNumber); + void WSOUND(int soundNumber); + void VOICE_MIX(int a1, int a2); }; } // End of namespace Hopkins |