diff options
author | Paul Gilbert | 2012-09-26 23:34:10 +1000 |
---|---|---|
committer | Paul Gilbert | 2012-09-26 23:34:10 +1000 |
commit | 1885141be56d3ce0acc58098876488c73ad26d2b (patch) | |
tree | 1d56f0c0dbac8cdf492e7e98663f192ad39b3986 /engines | |
parent | ddb4fdcf12f8a0e09d7f9b5583984edec99325cc (diff) | |
download | scummvm-rg350-1885141be56d3ce0acc58098876488c73ad26d2b.tar.gz scummvm-rg350-1885141be56d3ce0acc58098876488c73ad26d2b.tar.bz2 scummvm-rg350-1885141be56d3ce0acc58098876488c73ad26d2b.zip |
HOPKINS: Starting implementation of talk manager
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hopkins/files.cpp | 8 | ||||
-rw-r--r-- | engines/hopkins/files.h | 2 | ||||
-rw-r--r-- | engines/hopkins/globals.cpp | 1 | ||||
-rw-r--r-- | engines/hopkins/globals.h | 2 | ||||
-rw-r--r-- | engines/hopkins/hopkins.cpp | 86 | ||||
-rw-r--r-- | engines/hopkins/hopkins.h | 2 | ||||
-rw-r--r-- | engines/hopkins/module.mk | 3 | ||||
-rw-r--r-- | engines/hopkins/objects.h | 1 | ||||
-rw-r--r-- | engines/hopkins/talk.cpp | 139 | ||||
-rw-r--r-- | engines/hopkins/talk.h | 57 |
10 files changed, 286 insertions, 15 deletions
diff --git a/engines/hopkins/files.cpp b/engines/hopkins/files.cpp index 68c32bfde0..4e8eb0d80f 100644 --- a/engines/hopkins/files.cpp +++ b/engines/hopkins/files.cpp @@ -168,7 +168,7 @@ byte *FileManager::LIBERE_FICHIER(byte *ptr) { return PTRNUL; } -bool FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { +byte *FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { byte *ptr = NULL; Common::File f; @@ -266,7 +266,7 @@ bool FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { } // Scan for an entry in the catalogue - int result; + byte *result; bool matchFlag = false; int offsetVal = 0; @@ -304,9 +304,9 @@ bool FileManager::RECHERCHE_CAT(const Common::String &file, int a2) { bload_it(f, catData, GLOBALS.CAT_TAILLE); f.close(); - result = true; + result = catData; } else { - result = false; + result = NULL; } return result; diff --git a/engines/hopkins/files.h b/engines/hopkins/files.h index fbc8a04cab..b323006110 100644 --- a/engines/hopkins/files.h +++ b/engines/hopkins/files.h @@ -44,7 +44,7 @@ public: static int CONSTRUIT_SYSTEM(const Common::String &file); static void CONSTRUIT_FICHIER(const Common::String &hop, const Common::String &file); static byte *LIBERE_FICHIER(byte *ptr); - static bool RECHERCHE_CAT(const Common::String &file, int a2); + static byte *RECHERCHE_CAT(const Common::String &file, int a2); /** * Returns the size of a file. Throws an error if the file can't be found diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 446e5788f4..7074e05c0b 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -133,6 +133,7 @@ Globals::Globals() { NO_VISU = false; OPTION_FLAG = false; CACHEFLAG = false; + NOPARLE = false; } Globals::~Globals() { diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index 78601a916a..9d94873a09 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -180,6 +180,7 @@ struct CacheItem { // Note: Fields decimal based for now struct Sauvegarde { + int field4; int field353; int field354; int field355; @@ -323,6 +324,7 @@ public: int NBTRI; bool CACHEFLAG; int AFFINVEN; + bool NOPARLE; Globals(); ~Globals(); diff --git a/engines/hopkins/hopkins.cpp b/engines/hopkins/hopkins.cpp index 9ab4d4cf27..a13f9c0cdf 100644 --- a/engines/hopkins/hopkins.cpp +++ b/engines/hopkins/hopkins.cpp @@ -29,6 +29,7 @@ #include "hopkins/hopkins.h" #include "hopkins/files.h" #include "hopkins/sound.h" +#include "hopkins/talk.h" namespace Hopkins { @@ -831,7 +832,82 @@ void HopkinsEngine::INTRORUN() { } void HopkinsEngine::PASS() { - warning("TODO: PASS"); + if (_globals.FR == 1) + _graphicsManager.LOAD_IMAGE("ndfr"); + else + _graphicsManager.LOAD_IMAGE("nduk"); + + _graphicsManager.FADE_INW(); + if (_soundManager.VOICEOFF) + _eventsManager.delay(500); + else + _soundManager.VOICE_MIX(628, 4); + + _graphicsManager.FADE_OUTW(); + _globals.SORTIE = 4; +} + +void HopkinsEngine::ENDEMO() { + _soundManager.WSOUND(28); + if (_globals.FR == 1) + _graphicsManager.LOAD_IMAGE("endfr"); + else + _graphicsManager.LOAD_IMAGE("enduk"); + + _graphicsManager.FADE_INW(); + _eventsManager.delay(1500); + _graphicsManager.FADE_OUTW(); + _globals.SORTIE = 0; +} + +void HopkinsEngine::BOOM() { + _graphicsManager.nbrligne = 640; + _graphicsManager.SCANLINE(640); + _graphicsManager.DD_Lock(); + _graphicsManager.Cls_Video(); + _graphicsManager.DD_Unlock(); + _graphicsManager.Cls_Pal(); + + _globals.iRegul = 1; + _soundManager.SPECIAL_SOUND = 199; + _graphicsManager.FADE_LINUX = 2; + if (_globals.SVGA == 1) + _animationManager.PLAY_ANM("BOMBE2.ANM", 50, 14, 500); + if (_globals.SVGA == 2) + _animationManager.PLAY_ANM("BOMBE2A.ANM", 50, 14, 500); + + _soundManager.SPECIAL_SOUND = 0; + _graphicsManager.LOAD_IMAGE("IM15"); + _animationManager.CHARGE_ANIM("ANIM15"); + _graphicsManager.VISU_ALL(); + _animationManager.BOBANIM_OFF(7); + _globals.BPP_NOAFF = 1; + + for (int idx = 0; idx < 5; ++idx) { + _eventsManager.VBL(); + } + + _globals.BPP_NOAFF = 0; + _graphicsManager.FADE_INW(); + _eventsManager.MOUSE_OFF(); + + for (int idx = 0; idx < 20; ++idx) { + _eventsManager.VBL(); + } + + _globals.NOPARLE = true; + _talkManager.PARLER_PERSO2("vire.pe2"); + _globals.NOPARLE = false; + _animationManager.BOBANIM_ON(7); + + for (int idx = 0; idx < 100; ++idx) { + _eventsManager.VBL(); + } + + _graphicsManager.FADE_OUTW(); + _graphicsManager.FIN_VISU(); + _globals.iRegul = 0; + _globals.SORTIE = 151; } void HopkinsEngine::PERSONAGE(const Common::String &s1, const Common::String &s2, const Common::String &s3, @@ -890,12 +966,4 @@ void HopkinsEngine::COMPUT_HOPKINS(int a1) { warning("TODO: COMPUT_HOPKINS"); } -void HopkinsEngine::ENDEMO() { - warning("TODO: ENDEMO"); -} - -void HopkinsEngine::BOOM() { - warning("TODO: BOOM"); -} - } // End of namespace Hopkins diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 6e7c3db020..7692a83643 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -39,6 +39,7 @@ #include "hopkins/menu.h" #include "hopkins/objects.h" #include "hopkins/sound.h" +#include "hopkins/talk.h" /** * This is the namespace of the Hopkins engine. @@ -104,6 +105,7 @@ public: MenuManager _menuManager; ObjectsManager _objectsManager; SoundManager _soundManager; + TalkManager _talkManager; public: HopkinsEngine(OSystem *syst, const HopkinsGameDescription *gameDesc); virtual ~HopkinsEngine(); diff --git a/engines/hopkins/module.mk b/engines/hopkins/module.mk index fe84d67ccf..49b7c5fbca 100644 --- a/engines/hopkins/module.mk +++ b/engines/hopkins/module.mk @@ -12,7 +12,8 @@ MODULE_OBJS := \ hopkins.o \ menu.o \ objects.o \ - sound.o + sound.o \ + talk.o # This module can be built as a plugin ifeq ($(ENABLE_HOPKINS), DYNAMIC_PLUGIN) diff --git a/engines/hopkins/objects.h b/engines/hopkins/objects.h index 67460323e6..8212fa7dee 100644 --- a/engines/hopkins/objects.h +++ b/engines/hopkins/objects.h @@ -72,6 +72,7 @@ public: bool SL_FLAG; bool FLAG_VISIBLE; bool DESACTIVE_INVENT; + int DESACTIVE_CURSOR; bool BOBTOUS; SpriteItem Sprite[6]; public: diff --git a/engines/hopkins/talk.cpp b/engines/hopkins/talk.cpp new file mode 100644 index 0000000000..e3477628ee --- /dev/null +++ b/engines/hopkins/talk.cpp @@ -0,0 +1,139 @@ +/* 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 "common/textconsole.h" +#include "hopkins/talk.h" +#include "hopkins/files.h" +#include "hopkins/globals.h" +#include "hopkins/graphics.h" +#include "hopkins/hopkins.h" +#include "hopkins/objects.h" + +namespace Hopkins { + +void TalkManager::setParent(HopkinsEngine *vm) { + _vm = vm; +} + +void TalkManager::PARLER_PERSO2(const Common::String &filename) { + int v1; + int v2; + uint v3; + int v4; + int v5; + byte v7; + int v8; + int v9; + + v9 = 0; + _vm->_objectsManager.DESACTIVE_CURSOR = 1; + STATI = 1; + v7 = _vm->_objectsManager.DESACTIVE_INVENT; + _vm->_objectsManager.DESACTIVE_INVENT = 1; + BUFFERPERSO = FileManager::RECHERCHE_CAT(filename, 5); + TAILLEPERSO = _vm->_globals.CAT_TAILLE; + if (BUFFERPERSO == PTRNUL) { + FileManager::CONSTRUIT_FICHIER(_vm->_globals.HOPANIM, filename); + BUFFERPERSO = FileManager::CHARGE_FICHIER(_vm->_globals.NFICHIER); + TAILLEPERSO = FileManager::FLONG(_vm->_globals.NFICHIER); + } + + _vm->_globals.SAUVEGARDE->field4 = 0; + RENVOIE_FICHIER(0, FQUEST, (const char *)BUFFERPERSO); + RENVOIE_FICHIER(20, FREPON, (const char *)BUFFERPERSO); + + switch (_vm->_globals.FR) { + case 0: + FQUEST = "RUEAN.TXT"; + FREPON = "RUEAN.TXT"; + break; + case 1: + FQUEST = "RUE.TXT"; + FREPON = "RUE.TXT"; + break; + case 2: + FQUEST = "RUEES.TXT"; + FREPON = "RUEES.TXT"; + break; + } + + v1 = READ_LE_UINT16((uint16 *)BUFFERPERSO + 40); + PCHERCHE = 20 * READ_LE_UINT16((uint16 *)BUFFERPERSO + 42) + 110; + CHERCHE_PAL(PCHERCHE, 0); + PLIGNE1 = v1; + PLIGNE2 = v1 + 1; + PLIGNE3 = v1 + 2; + PLIGNE4 = v1 + 3; + v8 = _vm->_eventsManager.btsouris; + _vm->_eventsManager.btsouris = 4; + _vm->_eventsManager.CHANGE_MOUSE(0); + + if (!_vm->_globals.NOPARLE) { + v2 = v1 + 3; + do { + v3 = DIALOGUE(); + if ((signed __int16)v3 != v2) + v9 = DIALOGUE_REP(v3); + + if (v9 == -1) + v3 = v1 + 3; + } while ((signed __int16)v3 != v2); + } + + if (_vm->_globals.NOPARLE) { + v4 = 1; + do + v5 = DIALOGUE_REP(v4++); + while (v5 != -1); + } + + BUFFERPERSO = _vm->_globals.LIBERE_FICHIER(BUFFERPERSO); + _vm->_eventsManager.btsouris = v8; + + _vm->_eventsManager.CHANGE_MOUSE(v8); + _vm->_graphicsManager.INIT_TABLE(145, 150, _vm->_graphicsManager.Palette); + _vm->_graphicsManager.setpal_vga256(_vm->_graphicsManager.Palette); + _vm->_objectsManager.DESACTIVE_CURSOR = 0; + _vm->_objectsManager.DESACTIVE_INVENT = v7; + STATI = 0; +} + +void TalkManager::RENVOIE_FICHIER(int srcStart, Common::String &dest, const char *srcData) { + dest = Common::String(srcData + srcStart); +} + +int TalkManager::DIALOGUE_REP(int idx) { + warning("TODO: DIALOGUE_REP"); + return 0; +} + +int TalkManager::DIALOGUE() { + warning("TODO: DIALOGUE"); + return 0; +} + +void TalkManager::CHERCHE_PAL(int a1, int a2) { + +} + +} // End of namespace Hopkins diff --git a/engines/hopkins/talk.h b/engines/hopkins/talk.h new file mode 100644 index 0000000000..7c1ed0db94 --- /dev/null +++ b/engines/hopkins/talk.h @@ -0,0 +1,57 @@ +/* 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_TALK_H +#define HOPKINS_TALK_H + +#include "common/scummsys.h" +#include "common/str.h" + +namespace Hopkins { + +class HopkinsEngine; + +class TalkManager { +private: + HopkinsEngine *_vm; +public: + Common::String FQUEST; + Common::String FREPON; + byte *BUFFERPERSO; + size_t TAILLEPERSO; + int STATI; + int PLIGNE1, PLIGNE2; + int PLIGNE3, PLIGNE4; + int PCHERCHE; +public: + void setParent(HopkinsEngine *vm); + + void PARLER_PERSO2(const Common::String &filename); + void RENVOIE_FICHIER(int srcStart, Common::String &dest, const char *srcData); + int DIALOGUE_REP(int idx); + int DIALOGUE(); + void CHERCHE_PAL(int a1, int a2); +}; + +} // End of namespace Hopkins + +#endif /* HOPKINS_TALK_H */ |